/* =====================================================================================
   CUSTOM STYLES - Sistema de Gestión de Informes SDEC
   Estilo Profesional Premium v2.2 (Ultra Mobile Fix <430px)
   ===================================================================================== */

/* ===== VARIABLES CSS ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-hard: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.4);

    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== GLOBAL ENHANCEMENTS ===== */
body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

[data-bs-theme="dark"] body {
    background: var(--dark-gradient);
}

/* ===== NAVBAR PREMIUM ===== */
.navbar {
    background: var(--primary-gradient) !important;
    box-shadow: var(--shadow-medium);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1030;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff 0%, #e0e0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar .nav-link {
    font-weight: 500;
    transition: var(--transition-fast);
}

.navbar .nav-link:hover {
    transform: translateY(-1px);
}

/* ===== DROPDOWN Z-INDEX FIX ===== */
.navbar .dropdown-menu {
    z-index: 1040 !important;
    position: absolute !important;
    border: none;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-hard);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

[data-bs-theme="dark"] .navbar .dropdown-menu {
    background: rgba(30, 30, 50, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar .dropdown-item {
    border-radius: var(--border-radius-sm);
    padding: 0.6rem 1rem;
    transition: var(--transition-fast);
}

.navbar .dropdown-item:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.navbar .dropdown-divider {
    margin: 0.25rem 0;
    opacity: 0.1;
}

main,
.container,
.container-fluid {
    position: relative;
}

/* ===== REPORT HEADER ===== */
.report-header {
    padding: 1.5rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    z-index: 1;
}

[data-bs-theme="dark"] .report-header {
    background: linear-gradient(145deg, rgba(30, 30, 50, 0.9) 0%, rgba(22, 33, 62, 0.7) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.report-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.report-title code {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    padding: 0.3rem 0.7rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.9em;
    color: #667eea;
    font-weight: 600;
}

[data-bs-theme="dark"] .report-title {
    color: #fff;
}

[data-bs-theme="dark"] .report-title code {
    color: #a5b4fc;
}

/* ===== REPORT ACTION BUTTONS ===== */
.report-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.report-actions .btn {
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 991px) {
    .report-actions {
        justify-content: center;
    }

    .report-title {
        text-align: center;
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    .report-header {
        padding: 1rem;
    }

    .report-actions {
        flex-direction: column;
    }

    .report-actions .btn {
        width: 100%;
    }

    .report-title {
        font-size: 1.1rem;
    }

    .report-title code {
        display: block;
        margin-top: 0.5rem;
        font-size: 0.85em;
    }
}

/* ===== CARDS PREMIUM ===== */
.card {
    border: none;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-soft);
    transition: var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    font-weight: 600;
}

[data-bs-theme="dark"] .card {
    background: rgba(30, 30, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .card-header {
    background: rgba(102, 126, 234, 0.15);
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
}

/* ===== BUTTONS PREMIUM ===== */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition-slow);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-success {
    background: var(--secondary-gradient);
    border: none;
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 239, 125, 0.4);
}

.btn-danger {
    background: var(--danger-gradient);
    border: none;
}

.btn-warning {
    background: var(--warning-gradient);
    border: none;
    color: #fff;
}

.btn-info {
    background: var(--info-gradient);
    border: none;
    color: #fff;
}

/* ===== AI BUTTONS SPECIAL STYLES ===== */
.btn-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: aiGradient 3s ease infinite;
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-ai:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.btn-ai:disabled {
    background: #6c757d;
    animation: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-ai:disabled::after {
    content: ' (Sin IA)';
    font-size: 0.75em;
    opacity: 0.8;
}

@keyframes aiGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.btn-manual {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(9, 132, 227, 0.3);
}

.btn-manual:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(9, 132, 227, 0.5);
    color: #fff;
}

/* ===== FORM CONTROLS ===== */
.form-control,
.form-select {
    border-radius: var(--border-radius-sm);
    border: 2px solid #e0e0e0;
    padding: 0.75rem 1rem;
    transition: var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background: rgba(30, 30, 50, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #667eea;
    background: rgba(30, 30, 50, 0.8);
}

/* ===== TABS PREMIUM ===== */
.nav-tabs {
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.nav-tabs .nav-link {
    border: none;
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: #6c757d;
    transition: var(--transition-fast);
    position: relative;
}

.nav-tabs .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--primary-gradient);
    transition: var(--transition-normal);
    transform: translateX(-50%);
    border-radius: 3px 3px 0 0;
}

.nav-tabs .nav-link:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.nav-tabs .nav-link.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    font-weight: 600;
}

.nav-tabs .nav-link.active::after {
    width: 100%;
}

/* ===== ACCORDION PREMIUM ===== */
.accordion-item {
    border: none;
    border-radius: var(--border-radius-md) !important;
    margin-bottom: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.accordion-button {
    font-weight: 600;
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: var(--border-radius-md) !important;
}

.accordion-button:not(.collapsed) {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: #667eea;
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* ===== JOURNEY CARDS ===== */
.journey-item {
    border-left: 4px solid #667eea;
    transition: var(--transition-normal);
}

.journey-item:hover {
    border-left-color: #764ba2;
    transform: translateX(4px);
}

.journey-item .card-header {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.08) 0%, transparent 100%);
}

/* ===== EVIDENCE ITEMS ===== */
.evidence-item {
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    background: rgba(102, 126, 234, 0.03);
}

.evidence-item:hover {
    background: rgba(102, 126, 234, 0.08);
    transform: scale(1.02);
}

.evidence-item img {
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-soft);
}

/* ===== TABLES PREMIUM ===== */
.table {
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.table thead {
    background: var(--primary-gradient);
    color: #fff;
}

.table thead th {
    border: none;
    font-weight: 600;
    padding: 1rem;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* ===== BADGES PREMIUM ===== */
.badge {
    border-radius: 50px;
    padding: 0.5em 1em;
    font-weight: 500;
}

.badge.bg-success {
    background: var(--secondary-gradient) !important;
}

.badge.bg-danger {
    background: var(--danger-gradient) !important;
}

/* ===== ALERTS PREMIUM ===== */
.alert {
    border: none;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-soft);
}

.alert-info {
    background: linear-gradient(90deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%);
    border-left: 4px solid #4facfe;
}

.alert-success {
    background: linear-gradient(90deg, rgba(17, 153, 142, 0.1) 0%, rgba(56, 239, 125, 0.1) 100%);
    border-left: 4px solid #38ef7d;
}

.alert-danger {
    background: linear-gradient(90deg, rgba(235, 51, 73, 0.1) 0%, rgba(244, 92, 67, 0.1) 100%);
    border-left: 4px solid #eb3349;
}

.alert-warning {
    background: linear-gradient(90deg, rgba(240, 147, 251, 0.1) 0%, rgba(245, 87, 108, 0.1) 100%);
    border-left: 4px solid #f093fb;
}

/* ===== MODALS PREMIUM ===== */
.modal-content {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-hard);
    overflow: hidden;
}

.modal-header {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-footer {
    background: rgba(102, 126, 234, 0.05);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

/* ===== LOGIN PAGE PREMIUM ===== */
.card.mt-5 {
    border: none;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-hard);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    backdrop-filter: blur(20px);
}

[data-bs-theme="dark"] .card.mt-5 {
    background: linear-gradient(145deg, rgba(30, 30, 50, 0.95) 0%, rgba(22, 33, 62, 0.85) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card.mt-5 .card-title {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* ===== ADD JOURNEY FORM SPECIAL ===== */
.add-journey-card {
    background: linear-gradient(145deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: 2px dashed rgba(102, 126, 234, 0.3);
    border-radius: var(--border-radius-lg);
    transition: var(--transition-normal);
}

.add-journey-card:hover {
    border-color: rgba(102, 126, 234, 0.6);
    background: linear-gradient(145deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
}

.add-journey-card .card-header {
    background: transparent;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.btn-group-journey {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-group-journey .btn {
    flex: 1;
    min-width: 140px;
}

/* ===== SCROLLBAR CUSTOM ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ===== PULSE ANIMATION ===== */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.pulse-animation {
    animation: pulse 2s infinite;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {

    .card-header h3,
    .card-header h4,
    .card-header h5 {
        font-size: 1rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .btn-group-journey {
        flex-direction: column;
    }

    .btn-group-journey .btn {
        width: 100%;
    }
}

/* ===== TOOLTIP STYLES ===== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: #1a1a2e;
    color: #fff;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ===== STATUS INDICATORS ===== */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}

.status-indicator.active::before {
    background: #38ef7d;
}

.status-indicator.inactive::before {
    background: #eb3349;
    animation: none;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ===== ICON BUTTON STYLES ===== */
.icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    font-size: 1rem;
}

.icon-btn-sm {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

/* ===== GLASS MORPHISM EFFECT ===== */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-lg);
}

[data-bs-theme="dark"] .glass {
    background: rgba(30, 30, 50, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== FLOATING LABELS ENHANCEMENT ===== */
.form-floating>.form-control:focus~label,
.form-floating>.form-control:not(:placeholder-shown)~label {
    color: #667eea;
}

/* ===== PROGRESS BAR CUSTOM ===== */
.progress {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.05);
}

.progress-bar {
    background: var(--primary-gradient);
    border-radius: 4px;
}

/* ===== SHIMMER LOADING EFFECT ===== */
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ===== HOVER LIFT EFFECT ===== */
.hover-lift {
    transition: var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

/* ===== IMAGE EDITOR ENHANCEMENTS ===== */
.img-container {
    background-color: #f7f7f7;
    width: 100%;
    min-height: 400px;
    max-height: 70vh;
}

[data-bs-theme="dark"] .img-container {
    background-color: #1a1a2e;
}

.cropper-view-box,
.cropper-face {
    border-radius: 0;
}

.cropper-line,
.cropper-point {
    background-color: #667eea;
}

#cropImageModal .modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
}

@media (max-width: 576px) {
    #cropImageModal .modal-footer {
        flex-direction: column;
        gap: 12px;
    }

    #cropImageModal .modal-footer .me-auto {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    #cropImageModal .modal-footer button {
        width: 100%;
    }

    #cropImageModal .modal-footer .me-auto button {
        flex: 1;
        min-width: 45%;
    }
}

/* Mejoras para Inputs y Modo Oscuro en Formularios */
[data-bs-theme="dark"] .card {
    background-color: #1e2235;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .input-group-text {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

[data-bs-theme="dark"] .form-control:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #667eea;
    color: #fff;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
}

[data-bs-theme="dark"] .form-label {
    color: #cbd5e0;
}

/* Efecto de foco para grupos de input */
.input-group:focus-within .input-group-text {
    border-color: #667eea;
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
}

.input-group:focus-within .form-control {
    border-color: #667eea;
}

/* Estilo para el botón de cancelar en modo oscuro */
[data-bs-theme="dark"] .btn-link {
    color: #a0aec0;
}

[data-bs-theme="dark"] .btn-link:hover {
    color: #fff;
}

/* FIX: Desbordamiento y alineación de iconos en input-group */
.input-group {
    border-radius: var(--border-radius-md) !important;
    overflow: hidden;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .input-group {
    border-color: rgba(255, 255, 255, 0.1);
}

.input-group-text {
    background-color: rgba(0, 0, 0, 0.03);
    border: none !important;
    border-radius: 0 !important;
    padding: 0 1.2rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
}

[data-bs-theme="dark"] .input-group-text {
    background-color: rgba(255, 255, 255, 0.05);
    color: #667eea;
}

.input-group .form-control {
    border: none !important;
    border-radius: 0 !important;
    padding: 0.8rem 1rem;
    flex: 1;
    background-color: transparent !important;
}

/* Estado de foco para todo el grupo */
.input-group:focus-within {
    border-color: #667eea !important;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
}

/* Ajustes adicionales para móviles */
.navbar-toggler:focus,
.nav-link:focus {
    box-shadow: none !important;
}

/* =====================================================================================
   MOBILE NOTIFICATIONS FIX (< 430px SAFE)
   ===================================================================================== */
@media (max-width: 991px) {

    /* 1. Limpiar interferencias del Navbar */
    .navbar {
        transform: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* 2. Caja de Notificaciones ULTRA ROBUSTA */
    #notificationDropdown+.dropdown-menu,
    .navbar .dropdown-menu.show {
        position: fixed !important;
        z-index: 9999 !important;

        /* ANCLAJE LATERAL: Esto evita que se salga de la pantalla en dispositivos pequeños */
        inset: auto !important;
        top: 70px !important;
        left: 10px !important;
        right: 10px !important;

        /* Dejar que el ancho sea automático basado en left/right */
        width: auto !important;
        margin: 0 !important;

        /* Limites */
        max-width: 450px !important;
        /* No muy ancho en tablets */
        margin-left: auto !important;
        /* Centrado en tablets */
        margin-right: auto !important;
        /* Centrado en tablets */

        /* Scroll Vertical */
        max-height: 80vh !important;
        overflow-y: auto !important;

        /* Estilos de caja */
        background-color: #ffffff !important;
        border-radius: 12px !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        display: block !important;
    }

    /* 3. FIX DE CONTENIDO DESBORDADO (TEXTOS LARGOS) */
    /* Forzar que el texto salte de línea y no estire la caja */
    .navbar .dropdown-menu .dropdown-item,
    .navbar .dropdown-menu p,
    .navbar .dropdown-menu h6,
    .navbar .dropdown-menu span {
        white-space: normal !important;
        /* Permitir salto de línea */
        word-wrap: break-word !important;
        /* Romper palabras largas */
        overflow-wrap: break-word !important;
    }

    /* Reducir padding en items para ganar espacio en pantallas <350px */
    .navbar .dropdown-item {
        padding: 10px 12px !important;
    }

    /* 4. MODO OSCURO */
    [data-bs-theme="dark"] #notificationDropdown+.dropdown-menu,
    [data-bs-theme="dark"] .navbar .dropdown-menu.show {
        background-color: #1e2235 !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
    }

    .dropdown-menu::before,
    .dropdown-menu::after {
        display: none !important;
    }
}

/* =====================================================================================
   ADDITIONAL MOBILE OPTIMIZATIONS (Fix Jornadas & Modals)
   ===================================================================================== */
@media (max-width: 768px) {

    /* 1. Reduce excessive padding/margins in Jornadas */
    main.container.py-5 {
        padding-top: 1.5rem !important;
        padding-bottom: 2rem !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .card-body {
        padding: 1rem 0.75rem !important;
    }

    .accordion-body {
        padding: 1rem 0.5rem !important;
    }

    .journey-item {
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: var(--border-radius-sm) !important;
    }

    .journey-item .card-header {
        padding: 0.75rem !important;
    }

    .journey-item h5 {
        font-size: 0.95rem !important;
    }

    /* 2. Fix Modal Content (Summary & Preview) */
    #summary-report-content,
    #report-preview-content,
    .modal-body {
        padding: 0.5rem !important;
        overflow-x: auto !important;
        /* Force scroll if content is too wide */
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Transform Table to Cards on Mobile (Aggressive Version) */
    .mobile-table-cards,
    .mobile-table-cards thead,
    .mobile-table-cards tbody,
    .mobile-table-cards tr,
    .mobile-table-cards td,
    .mobile-table-cards th {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .mobile-table-cards thead {
        display: none !important;
        /* Hide headers on mobile */
    }

    .mobile-table-cards tr {
        margin-bottom: 2rem !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-radius: var(--border-radius-md) !important;
        background: #ffffff !important;
        box-shadow: var(--shadow-medium) !important;
        padding: 10px !important;
    }

    [data-bs-theme="dark"] .mobile-table-cards tr {
        background: #1e2235 !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }

    .mobile-table-cards td {
        padding: 12px 10px !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        text-align: left !important;
        position: relative;
    }

    .mobile-table-cards td:last-child {
        border-bottom: none !important;
    }

    /* Use data-label for headers in card mode */
    .mobile-table-cards td::before {
        content: attr(data-label);
        display: block;
        font-weight: 800;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: #667eea;
        margin-bottom: 0.5rem;
        letter-spacing: 0.5px;
    }

    /* Force all contents inside preview to respect width */
    #report-preview-content *,
    .mobile-table-cards * {
        max-width: 100% !important;
        overflow-wrap: break-word !important;
        box-sizing: border-box !important;
    }

    #report-preview-content img {
        height: auto !important;
        margin: 15px auto !important;
        display: block !important;
        border-radius: var(--border-radius-sm);
        box-shadow: var(--shadow-soft);
    }
}