/* Responsive CSS - Mobile and tablet styles */

/* Arrow direction based on language */
[dir="rtl"] .arrow-ltr {
    display: none;
}

[dir="rtl"] .arrow-rtl {
    display: inline;
}

[dir="ltr"] .arrow-rtl {
    display: none;
}

[dir="ltr"] .arrow-ltr {
    display: inline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    /* Navbar adjustments - SOLID BACKGROUND */
    .navbar {
        padding: 4px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background-color: #ffffff !important;
        border-bottom: 1px solid #e2e8f0;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }
    
    /* All cards and containers on mobile - square corners */
    *,
    *::before,
    *::after,
    .patient-select-card,
    .patient-card,
    .session-card,
    .step-card,
    .app-container,
    .nav-container,
    .stepper-container,
    .upload-area,
    .choice-btn,
    .result-area,
    .modal-content,
    .language-selector,
    .language-btn,
    .nav-links a,
    .nav-btn,
    .file-label,
    .record-btn,
    .step,
    .step-connector,
    input,
    textarea,
    select,
    button,
    div,
    section,
    article,
    aside,
    header,
    footer,
    main,
    form {
        border-radius: 0 !important;
    }
    
    /* Exception: Keep step-circle as perfect circles */
    .step-circle {
        border-radius: 50% !important;
    }

    .patient-select-card > div:first-child {
        flex-direction: column;
        align-items: stretch;
    }

    .patient-select-card > div:first-child > div:last-child {
        margin-left: 0;
        margin-top: 10px;
        justify-content: flex-start;
    }

    .patient-select-card .nav-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    /* Improved navigation layout for mobile */
    .nav-container {
        flex-direction: column;
        padding: 2px;
        gap: 1px;
        align-items: stretch;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
        margin: 0;
    }
    
    #userSection {
        order: 2;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        width: 100%;
        margin-top: 0;
    }
    
    #userSection {
        align-items: center;
    }
    
    #userSection > div {
        flex: 1;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 8px;
        align-items: center;
        padding-left: 8px;
    }
    
    .language-selector {
        order: 2;
        flex: 0 0 auto;
        justify-content: flex-end;
        margin-right: 8px;
        margin-top: 0;
    }
    
    .nav-links {
        order: 3;
        display: flex !important;
        flex: 1;
        justify-content: center;
        padding: 0;
        margin: 0;
        gap: 8px;
    }
    
    #userGreeting {
        display: block !important;
        font-size: 12px;
        text-align: right;
        margin-bottom: 0;
        margin-left: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
        flex-shrink: 0;
        font-weight: 600;
        color: #1e293b;
    }
    
    #logoutBtn {
        padding: 2px 6px;
        font-size: 10px;
        flex-shrink: 0;
    }
    
    .logo {
        order: 1;
        text-align: center;
        margin-bottom: 1px;
        font-size: 12px;
        padding: 1px 0;
    }
    
    .logo span:first-child {
        font-size: 0.9em;
    }
    
    /* Language and nav links row styling for mobile */
    .language-selector {
        display: flex;
        justify-content: center;
        padding: 2px 0;
    }
    
    .language-selector select {
        padding: 4px 8px;
        font-size: 11px;
        border-radius: 3px;
    }
    
    .language-btn {
        flex: 0 0 auto;
        justify-content: center;
        min-width: 60px;
        padding: 3px 6px;
        font-size: 9px;
        border-radius: 3px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }
    
    .language-btn.active {
        transform: scale(1.05);
        box-shadow: 0 4px 8px rgba(192, 110, 79, 0.28);
    }
    
    /* Home link styling for mobile - COMPACT WITH TEXT */
    .nav-links {
        margin: 2px 3px;
        height: 50px;
        border: none !important;
        background-color: #e8f4f8;
        padding: 0;
        border-radius: 3px;
        align-items: center;
    }
    
    .nav-links li {
        flex: 1;
        margin: 0;
        height: 100%;
        display: flex;
        align-items: center;
    }
    
    .nav-links a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 4px 6px;
        font-size: 10px;
        font-weight: 600;
        border-radius: 0 !important;
        background-color: transparent !important;
        box-shadow: none !important;
        border: none !important;
        width: 100%;
        height: 100%;
        gap: 2px;
    }
    
    .nav-links a svg {
        width: 20px;
        height: 20px;
    }
    
    .nav-links a span {
        display: block !important;
        font-size: 10px;
        line-height: 1.2;
    }
    
    /* App section adjustments */
    .app-section {
        padding: 200px 0 40px;
        background: #e8f4f8;
    }
    
    .app-container {
        padding: 15px;
        margin: 5px 4px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    /* Container for patients page - ensure same margins as navbar */
    .container {
        padding: 0 4px;
        margin: 0;
    }
    
    /* Ensure patients page app-container has consistent styling */
    .container .app-container {
        margin: 5px 0;
    }

    /* Patients page specific adjustments */
    .container .step-card {
        margin-top: 10px;
        padding: 20px 15px;
    }
    
    /* Patients page header spacing */
    .container .step-card h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
    }
    
    .container .step-card h2 {
        font-size: 1.4em;
        margin-bottom: 15px;
    }

    /* Stepper container spacing */
    .stepper-container {
        margin-bottom: 25px;
        margin-top: 10px;
        padding: 10px 8px;
        background: #e8f4f8;
        border-radius: 8px;
    }

    .stepper {
        padding: 8px 0;
    }

    .step-card {
        padding: 24px 20px;
        margin-top: 15px;
        border-radius: 10px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    }

    .step-card h2 {
        font-size: 1.3em;
        flex-direction: row;
        text-align: center;
        min-height: auto;
        gap: 8px;
    }
    
    .step-card h2 span {
        font-size: 1em;
    }

    .choice-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    /* COMPACT choice buttons for mobile - Save space */
    .choice-btn {
        padding: 12px 16px !important;
        min-height: 70px !important;
        height: 70px !important;
        flex-direction: row-reverse !important;
        text-align: right !important;
        gap: 16px !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .choice-btn .icon-wrapper {
        width: 40px !important;
        height: 40px !important;
        margin: 0 !important;
        flex-shrink: 0;
        align-self: center !important;
        order: 1;
    }
    
    .choice-btn .icon-wrapper svg {
        width: 20px !important;
        height: 20px !important;
    }
    
    .choice-btn > div:not(.icon-wrapper) {
        display: flex;
        flex-direction: column;
        align-items: flex-end !important;
        justify-content: center !important;
        flex: 1;
        text-align: right !important;
        order: 2;
    }
    
    .choice-btn h3 {
        font-size: 1em !important;
        margin: 0 !important;
        text-align: right !important;
        width: 100%;
    }
    
    .choice-btn small {
        display: none !important;
    }

    /* Navigation buttons in a single row */
    .step-navigation {
        display: flex;
        flex-direction: row;
        gap: 12px;
        padding: 15px;
        width: 100%;
        border-top: 1px solid #f1f5f9;
        background: white;
        margin-top: 20px;
    }

    .nav-btn {
        flex: 1;
        height: 48px;
        border-radius: 10px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    
    /* Next button - strong purple when enabled */
    .nav-btn.primary:not(:disabled) {
        background-color: #C06E4F !important;
        color: white;
        border: none;
        box-shadow: 0 4px 10px rgba(192, 110, 79, 0.20);
        transition: all 0.3s ease;
    }
    
    /* Next button - light purple when disabled */
    .nav-btn.primary:disabled {
        background-color: #a5b4fc;
        color: white;
        border: none;
        opacity: 0.6;
    }
    
    /* Back button - white with purple border */
    .nav-btn.back {
        background-color: white;
        color: #C06E4F;
        border: 1px solid #C06E4F;
    }
    
    /* Make sure empty divs don't interfere with ordering */
    .step-navigation > div:empty {
        display: none;
    }

    .upload-area {
        padding: 40px 20px;
    }

    /* Upload buttons - SYMMETRIC */
    #recordingButtons {
        display: flex;
        flex-direction: column;
        gap: 12px;
        max-width: 340px;
        margin: 0 auto;
        padding: 0 15px;
    }

    .file-label,
    .record-btn {
        width: 100% !important;
        height: 52px !important;
        margin: 0 !important;
        padding: 14px 24px !important;
        border-radius: 12px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        box-sizing: border-box !important;
    }

    /* Hide upload area completely when recording */
    .upload-area:has(+ #recordingStatus:not([style*="display: none"])) {
        display: none !important;
    }

    /* Recording controls - Simplified layout for mobile */
    .recording-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
        width: 100%;
        max-width: 340px;
        margin: 20px auto;
        padding: 0 15px;
    }
    
    /* Timer spacing */
    #recordingTime {
        margin-top: 20px;
        margin-bottom: 15px;
    }

    /* MODE 1: Pause button (during recording) */
    .btn-main,
    .btn-pause {
        width: 100%;
        height: 56px;
        background-color: #C06E4F;
        color: white;
        padding: 14px 24px;
        border-radius: 16px;
        font-weight: 700;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        box-shadow: 0 4px 6px -1px rgba(192, 110, 79, 0.20);
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 1rem;
    }

    .btn-pause:hover {
        transform: scale(1.05);
        background: #A85838;
        box-shadow: 0 6px 18px rgba(192, 110, 79, 0.38);
    }

    /* MODE 2: Paused actions - Two symmetric buttons */
    .paused-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .btn-finish,
    .btn-resume {
        width: 100%;
        height: 56px;
        padding: 14px 24px;
        border-radius: 16px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 1rem;
        border: none;
    }

    /* Finish button - PRIMARY */
    .btn-finish {
        background-color: #C06E4F;
        color: white;
        box-shadow: 0 4px 6px -1px rgba(192, 110, 79, 0.20);
    }

    .btn-finish:hover {
        transform: scale(1.05);
        background: #A85838;
        box-shadow: 0 6px 18px rgba(192, 110, 79, 0.38);
    }

    /* Resume button - SECONDARY */
    .btn-resume {
        background-color: white;
        color: #C06E4F;
        border: 2px solid #C06E4F;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .btn-resume:hover {
        transform: scale(1.05);
        background: rgba(192, 110, 79, 0.05);
        box-shadow: 0 4px 12px rgba(192, 110, 79, 0.20);
    }

    /* Delete button - DANGER (smaller, centered) */
    .btn-delete {
        background-color: #fff1f2;
        color: #e11d48;
        border: 1px solid #ffe4e6;
        padding: 8px 20px;
        border-radius: 12px;
        font-size: 0.85rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        margin: 20px auto 0;
        cursor: pointer;
        transition: all 0.2s ease;
        width: 100%;
        max-width: 180px;
    }

    .btn-delete:hover {
        background: #ffe4e6;
        border-color: #fb7185;
        transform: scale(1.02);
    }

    /* Hide upload area when recording */
    #recordingStatus:not([style*="display: none"]) ~ #recordingButtons,
    #recordingStatus:not([style*="display: none"]) ~ .upload-area > p,
    #recordingStatus:not([style*="display: none"]) ~ .upload-area > div:first-child {
        display: none !important;
    }

    /* Step cards - reduce padding on mobile */
    .step-card {
        padding: 24px 16px;
    }

    .nav-container {
        padding: 0 12px;
    }

    .logo span {
        font-size: 18px;
    }
    
    /* Mobile-specific Alert styling */
    #quotaWarningStep1 {
        padding: 24px !important;
        margin: 0 8px 20px 8px !important;
    }
    
    /* Select Patient Button - Full width and comfortable height */
    #selectExistingPatientBtn {
        min-height: 48px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 14px 20px !important;
    }
    
    /* Patient Name Input - Align with button width */
    #patientName {
        width: 100% !important;
    }
    
    /* Next Button - Align with input width */
    #step1Next {
        width: 100% !important;
    }
}

/* Patient Selection Modal Improvements */
@media (max-width: 768px) {
    /* Modal Width - 95% on mobile */
    #patientSelectionModal .modal-content {
        width: 95% !important;
        max-width: 95% !important;
    }
    
    /* Patient Card - Two Row Layout */
    .patient-select-card {
        padding: 16px !important;
        margin-bottom: 10px !important;
    }
    
    .patient-select-card > div:first-child {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        align-items: stretch !important;
    }
    
    /* Patient Info Section - Stack name and treatment count */
    .patient-select-card > div:first-child > div:first-child {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        text-align: right !important;
    }
    
    /* Patient Name - With icon */
    .patient-select-card > div:first-child > div:first-child strong {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        /* Handle long names */
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        max-width: 100% !important;
    }
    
    /* Treatment Count - Smaller, gray */
    .patient-select-card > div:first-child > div:first-child small {
        font-size: 13px !important;
        color: #64748b !important;
        font-weight: 500 !important;
    }
    
    /* Button Container */
    .patient-select-card > div:first-child > div:last-child {
        display: flex !important;
        justify-content: flex-start !important;
        margin-left: 0 !important;
    }
    
    /* "בחר" Button - Compact */
    .patient-select-card .nav-btn {
        padding: 10px 20px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        flex-shrink: 0 !important;
    }
    
    /* Search Field - With icon */
    #patientSearchInput {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: right 12px center !important;
        padding-right: 45px !important;
    }
    
    /* Cancel Button - Simple text button */
    #patientSelectionModal .modal-footer .nav-btn.neutral {
        background: transparent !important;
        border: none !important;
        color: #64748b !important;
        padding: 12px 24px !important;
        font-size: 14px !important;
        box-shadow: none !important;
    }
    
    #patientSelectionModal .modal-footer .nav-btn.neutral:hover {
        background: #f1f5f9 !important;
        color: #475569 !important;
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    /* Compact Header - Save Screen Space */
    .nav-container {
        padding: 8px 12px !important;
    }
    
    /* Keep user greeting visible - just make it smaller */
    #userGreeting {
        font-size: 10px !important;
    }
    
    /* Make logo more compact */
    .logo {
        font-size: 18px !important;
    }
    
    .logo span {
        display: none !important;
    }
    
    /* Scale down stepper to save space */
    .stepper-container {
        transform: scale(0.85);
        margin-bottom: 5px !important;
        margin-top: 5px !important;
    }
    
    /* Improved language buttons for very small screens */
    .language-selector {
        padding: 8px 0;
        gap: 10px;
    }
    
    .language-btn {
        min-width: 110px;
        padding: 10px;
        font-size: 13px;
    }
    
    /* Adjust nav links for very small screens */
    .nav-links a {
        padding: 8px 12px;
        font-size: 15px;
    }
    
    /* Keep nav links text visible */
    .nav-links a span {
        display: block !important;
        font-size: 10px;
        line-height: 1.2;
    }
}

/* Special styles for input fields on mobile */
@media (max-width: 768px) {
    /* Ensure patient name input is interactive */
    #patientName {
        pointer-events: auto !important;
        user-select: text !important;
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        opacity: 1 !important;
        cursor: text !important;
        position: relative !important;
        z-index: 10 !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
    }

    /* Ensure date and time inputs are interactive */
    #sessionDate, #sessionTime {
        pointer-events: auto !important;
        user-select: text !important;
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        opacity: 1 !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 10 !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        background-color: white !important;
    }

    /* Fix date/time input on mobile */
    input[type="date"], input[type="time"] {
        min-height: 50px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    /* Ensure date/time inputs are clickable on iOS */
    input[type="date"]::-webkit-calendar-picker-indicator,
    input[type="time"]::-webkit-calendar-picker-indicator {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: auto;
        color: transparent;
        background: transparent;
        cursor: pointer;
    }

    /* Ensure the form group containing patient name is not blocked */
    .step-content[data-step="1"] .form-group {
        position: relative;
        z-index: 5;
    }

    /* Debug: Add visible border to patient name input */
    #patientName:focus {
        border-color: #ff0000 !important;
        box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.3) !important;
    }

    /* Ensure text input textarea is interactive */
    #directTextInput {
        pointer-events: auto !important;
        user-select: text !important;
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        opacity: 1 !important;
        cursor: text !important;
        position: relative !important;
        z-index: 10 !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        resize: vertical !important;
    }

    /* Ensure the form group containing text input is not blocked */
    #textInputCard .form-group {
        position: relative;
        z-index: 5;
    }
}

/* Desktop Responsive - EXACTLY Like Mobile! */
@media (min-width: 769px) {
    /* Recording controls - VERTICAL layout (like mobile) */
    .recording-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
        width: 100%;
        max-width: 400px;
        margin: 20px auto;
        padding: 0 15px;
    }

    /* MODE 1: Pause button (during recording) */
    .btn-main,
    .btn-pause {
        width: 100%;
        height: 56px;
        background-color: #C06E4F;
        color: white;
        padding: 14px 24px;
        border-radius: 16px;
        font-weight: 700;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        box-shadow: 0 4px 6px -1px rgba(192, 110, 79, 0.20);
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 1rem;
    }

    .btn-pause:hover {
        transform: scale(1.05);
        background: #A85838;
        box-shadow: 0 6px 18px rgba(192, 110, 79, 0.38);
    }

    /* MODE 2: Paused actions - Two symmetric buttons */
    .paused-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .btn-finish,
    .btn-resume {
        width: 100%;
        height: 56px;
        padding: 14px 24px;
        border-radius: 16px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 1rem;
        border: none;
    }

    /* Finish button - PRIMARY */
    .btn-finish {
        background-color: #C06E4F;
        color: white;
        box-shadow: 0 4px 6px -1px rgba(192, 110, 79, 0.20);
    }

    .btn-finish:hover {
        transform: scale(1.05);
        background: #A85838;
        box-shadow: 0 6px 18px rgba(192, 110, 79, 0.38);
    }

    /* Resume button - SECONDARY */
    .btn-resume {
        background-color: white;
        color: #C06E4F;
        border: 2px solid #C06E4F;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .btn-resume:hover {
        transform: scale(1.05);
        background: rgba(192, 110, 79, 0.05);
        box-shadow: 0 4px 12px rgba(192, 110, 79, 0.20);
    }

    /* Delete button - DANGER (smaller, centered) */
    .btn-delete {
        background-color: #fff1f2;
        color: #e11d48;
        border: 1px solid #ffe4e6;
        padding: 8px 20px;
        border-radius: 12px;
        font-size: 0.85rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        margin: 20px auto 0;
        cursor: pointer;
        transition: all 0.2s ease;
        width: 100%;
        max-width: 180px;
    }

    .btn-delete:hover {
        background: #ffe4e6;
        border-color: #fb7185;
        transform: scale(1.02);
    }
}

/* Dark mode nav-links bar on mobile */
@media (max-width: 768px) {
    [data-theme="dark"] .nav-links { background-color: #0f172a !important; border-color: #334155 !important; }
    [data-theme="dark"] .nav-links a { color: #94a3b8 !important; }
    [data-theme="dark"] .nav-links a.active,
    [data-theme="dark"] .nav-links a:active { color: #C06E4F !important; background: #1e293b !important; }
    [data-theme="dark"] .nav-links a svg { stroke: currentColor !important; }
}

/* Override white navbar on mobile in dark mode */
@media (max-width: 768px) {
    [data-theme="dark"] .navbar { background-color: #1e293b !important; border-bottom-color: #334155 !important; }
}

/* ===== DARK MODE MOBILE — FINAL FIX ===== */
@media (max-width: 768px) {
    [data-theme="dark"] .nav-links { background-color: #0f172a !important; }
    [data-theme="dark"] .nav-links a { color: #94a3b8 !important; }
    [data-theme="dark"] .app-section { background: #0f172a !important; }
    [data-theme="dark"] .app-container { background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
}

/* ===== DARK MODE MOBILE — COMPREHENSIVE FIX ===== */
@media (max-width: 768px) {
    [data-theme="dark"] .nav-container { background: #1e293b !important; box-shadow: none !important; border-color: #334155 !important; }
    [data-theme="dark"] .nav-links { background-color: #0f172a !important; border-color: #334155 !important; }
    [data-theme="dark"] .nav-links a { color: #94a3b8 !important; }
    [data-theme="dark"] .navbar { background-color: #1e293b !important; }
    [data-theme="dark"] .app-section { background: #0f172a !important; }
    [data-theme="dark"] .app-container { background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
    [data-theme="dark"] .step-navigation { background: #1e293b !important; border-color: #334155 !important; }
    [data-theme="dark"] .modal-footer-modern,
    [data-theme="dark"] [class*="footer"] { background: #1e293b !important; border-color: #334155 !important; }
}

/* Dark mode date input on mobile */
@media (max-width: 768px) {
    [data-theme="dark"] input[type="date"],
    [data-theme="dark"] input[type="datetime-local"],
    [data-theme="dark"] input[type="time"] {
        color-scheme: dark;
        background: #0f172a !important;
        color: #f1f5f9 !important;
        border-color: #475569 !important;
    }
    [data-theme="dark"] input { background: #0f172a !important; color: #f1f5f9 !important; border-color: #475569 !important; }
}

/* CRITICAL: Override white background on date inputs in dark mode */
@media (max-width: 768px) {
    [data-theme="dark"] #sessionDate,
    [data-theme="dark"] #sessionTime {
        background-color: #0f172a !important;
        color: #f1f5f9 !important;
        border-color: #475569 !important;
        color-scheme: dark;
    }
}

/* ===== MOBILE UI POLISH ===== */
@media (max-width: 768px) {
    /* 1. Reduce top padding — less dead space */
    .app-section { padding-top: 155px !important; padding-bottom: 20px !important; }

    /* 2. App container — tighter */
    .app-container { padding: 12px 12px 20px !important; }

    /* 3. Step card — reduce bottom padding */
    .step-card { padding: 20px 14px 16px !important; margin-bottom: 0 !important; }

    /* 4. Step navigation — full-width buttons, no dead space */
    .step-navigation {
        margin-top: 16px !important;
        padding: 12px 0 0 !important;
        background: transparent !important;
        border-top: none !important;
        gap: 10px !important;
    }
    .nav-btn { height: 52px !important; border-radius: 14px !important; font-size: 15px !important; }
    .nav-btn.back {
        background: transparent !important;
        border: 2px solid #C06E4F !important;
        color: #C06E4F !important;
    }
    [data-theme="dark"] .nav-btn.back {
        border-color: #C06E4F !important;
        color: #C06E4F !important;
    }

    /* 5. Stepper — smaller circles, less margin */
    .step-circle { width: 36px !important; height: 36px !important; font-size: 14px !important; }
    .stepper-container { margin-bottom: 16px !important; padding: 10px 0 !important; }
    .step-connector { height: 2px !important; }
    .step-label { font-size: 10px !important; margin-top: 4px !important; }

    /* 6. Form group — tighter */
    .form-group { margin-bottom: 16px !important; }
    label { font-size: 14px !important; margin-bottom: 6px !important; }
}
