﻿.dark .trip-form,
.dark .trip-form p,
.dark .trip-form span,
.dark .trip-form label,
.dark .trip-form h2,
.dark .trip-form h3,
.dark .trip-form h4 {
    color: #e6ebff !important;
}
.dark .trip-form .trip-header,
.dark .trip-form .trip-header h3,
.dark .trip-form .trip-title {
    color: #f2f4ff !important;
}
.dark .trip-form .split-group {
    background: transparent !important;
}
.dark .form-group input,
.dark .form-group textarea,
.dark .form-group select {
    background: rgba(29, 35, 48, 0.95) !important;
    color: #f9fbff !important;
}
.dark .form-group input,
.dark .form-group textarea {
    border-width: 1px !important;
}
/* Theme toggle button */
.theme-toggle-btn {
    margin-top: 2.5rem;
    justify-content: flex-start;
}
.theme-icon {
    opacity: 0.6;
    filter: grayscale(0.3);
    transition: color 0.2s, opacity 0.2s;
}

body.dark {
    background: #181a1b !important;
    color: #f1f1f1 !important;
}
.dark .app-header {
    background: linear-gradient(135deg, #232946 0%, #1a1a2e 100%) !important;
    color: #f1f1f1 !important;
}
.dark .app-version {
    color: #ffe066 !important;
    opacity: 0.95 !important;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}
.dark .concept-switcher {
    color: rgba(255, 224, 102, 0.9) !important;
}

.dark .concept-label {
    color: rgba(255, 224, 102, 0.85) !important;
}

.dark .concept-select {
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid rgba(255, 224, 102, 0.45);
    color: #ffe066;
}

.dark .concept-select:hover,
.dark .concept-select:focus {
    border-color: rgba(255, 224, 102, 0.75);
    background: rgba(17, 24, 39, 0.78);
}
.dark .main-content,
.dark .app-container {
    background: #232946 !important;
    color: #f1f1f1 !important;
}
.dark .status-card,
.dark .trip-card {
    background: #232946 !important;
    border-color: #232946 !important;
    color: #f1f1f1 !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}
.dark .on-hold-card {
    background: rgba(30, 34, 55, 0.85) !important;
    border-color: rgba(148, 163, 184, 0.55) !important;
}
.dark .on-hold-route {
    color: #e2e8f0 !important;
}
.dark .on-hold-dates {
    color: #cbd5f5 !important;
}
.dark .on-hold-status {
    color: #fca5a5 !important;
}
.dark .on-hold-card .detail-section {
    border-color: rgba(148, 163, 184, 0.35) !important;
}
.dark .status-card.eccr-warning,
.dark .trip-card.eccr-warning {
    border-color: rgba(249, 115, 22, 0.75) !important;
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.35), rgba(234, 88, 12, 0.25)) !important;
    box-shadow: 0 12px 32px rgba(248, 113, 113, 0.25) !important;
}

.dark .status-card.eccr-conflict,
.dark .trip-card.eccr-conflict {
    border-color: rgba(239, 68, 68, 0.85) !important;
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.5), rgba(220, 38, 38, 0.32)) !important;
    box-shadow: 0 16px 36px rgba(239, 68, 68, 0.35) !important;
}

.dark .status-card.eccr-available,
.dark .trip-card.eccr-available {
    border-color: rgba(56, 189, 248, 0.75) !important;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.45), rgba(37, 99, 235, 0.3)) !important;
    box-shadow: 0 14px 34px rgba(37, 99, 235, 0.35) !important;
}
.dark .sidebar-nav {
    background: #181a1b !important;
    border-right: 1px solid #232946 !important;
}
.dark .sidebar-nav .nav-btn {
    color: #f1f1f1 !important;
}
.dark .sidebar-nav .nav-btn.active,
.dark .sidebar-nav .nav-btn:focus {
    color: #ffe066 !important;
    background: rgba(250, 204, 21, 0.08) !important;
}
.dark .theme-icon {
    color: #ffe066 !important;
    opacity: 0.7;
    filter: grayscale(0.1);
}
.dark .nav-text,
.dark .stat-label,
.dark .trip-header,
.dark .trip-route,
.dark .trip-dates,
.dark .trip-status,
.dark .detail-title,
.dark .detail-info,
.dark .stat-number {
    color: #f1f1f1 !important;
}
.dark .current-status h2,
.dark .next-transfer h2,
.dark .past-trips h2 {
    color: #ffe066 !important;
}
.dark .detail-section.section-flight {
    background-color: rgba(245, 158, 11, 0.15) !important;
    border-left-color: rgba(245, 158, 11, 0.7) !important;
}
.dark .detail-section.section-cabin {
    background-color: rgba(248, 113, 113, 0.18) !important;
    border-left-color: rgba(248, 113, 113, 0.7) !important;
}
.dark .detail-section.section-hotel {
    background-color: rgba(99, 102, 241, 0.18) !important;
    border-left-color: rgba(99, 102, 241, 0.7) !important;
}
.dark .detail-section.section-ship {
    background-color: rgba(16, 185, 129, 0.18) !important;
    border-left-color: rgba(16, 185, 129, 0.7) !important;
}
.dark .detail-section.section-next {
    background-color: rgba(14, 165, 233, 0.18) !important;
    border-left-color: rgba(14, 165, 233, 0.7) !important;
}
.dark .detail-section.detail-conflict {
    border-color: rgba(248, 113, 113, 0.55) !important;
    background: linear-gradient(120deg, rgba(127, 29, 29, 0.4), rgba(239, 68, 68, 0.25)) !important;
}
.dark .detail-section.detail-alert {
    border-color: rgba(249, 115, 22, 0.55) !important;
    background: linear-gradient(120deg, rgba(120, 53, 15, 0.4), rgba(249, 115, 22, 0.25)) !important;
}
.dark .detail-section.detail-highlight {
    border-color: rgba(37, 99, 235, 0.55) !important;
    background: linear-gradient(120deg, rgba(30, 64, 175, 0.45), rgba(59, 130, 246, 0.25)) !important;
}
.dark .detail-info {
    color: #d1d5db !important;
}
.dark .trip-actions .btn-edit,
.dark .trip-actions .btn-delete {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #f9fafb !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}
.dark .trip-actions .btn-edit:hover,
.dark .trip-actions .btn-delete:hover {
    background: rgba(255, 230, 102, 0.2) !important;
    color: #232946 !important;
}
.dark .form-section {
    background: rgba(24, 26, 27, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px;
    padding: 1.5rem !important;
    margin-bottom: 1.5rem !important;
}
.dark .form-section h3 {
    color: #ffe066 !important;
}
.dark .form-group label {
    color: #f1f5f9 !important;
}
.dark .form-group input,
.dark .form-group textarea,
.dark .form-group select {
    background: rgba(35, 41, 62, 0.85) !important;
    color: #f9fafb !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
}
.dark .form-group input::placeholder,
.dark .form-group textarea::placeholder {
    color: rgba(209, 213, 219, 0.7) !important;
}
.dark .form-group input:focus,
.dark .form-group textarea:focus {
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25) !important;
}
.dark h1,
.dark h2,
.dark h3,
.dark h4,
.dark h5,
.dark h6,
.dark p,
.dark label,
.dark span,
.dark li {
    color: #f5f5f5 !important;
}
.dark .current-status h2,
.dark .next-transfer h2,
.dark .past-trips h2 {
    color: #ffe066 !important;
}
.dark .stat-item {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: none !important;
}
.dark .detail-section {
    background: transparent !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
.dark .trip-actions .btn-edit,
.dark .trip-actions .btn-delete {
    color: #ffe066 !important;
    border: 1px solid rgba(255, 230, 102, 0.6) !important;
}
.dark .trip-actions .btn-edit:hover,
.dark .trip-actions .btn-delete:hover {
    background: #ffe066 !important;
    color: #232946 !important;
}
.dark .status-badge,
.dark .deadline-badge,
.dark .condensed-tag,
.dark .condensed-deadline {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.dark .status-badge {
    background: rgba(24, 30, 54, 0.85) !important;
    color: #f9fafb !important;
    border-color: rgba(119, 124, 179, 0.45) !important;
}
.dark .status-approval { background: rgba(129, 140, 248, 0.35) !important; border-color: rgba(129, 140, 248, 0.55) !important; }
.dark .status-approval-approved { background: rgba(16, 185, 129, 0.35) !important; border-color: rgba(16, 185, 129, 0.55) !important; }
.dark .status-approval-pending { background: rgba(251, 191, 36, 0.28) !important; border-color: rgba(251, 191, 36, 0.5) !important; }
.dark .status-approval-planned { background: rgba(59, 130, 246, 0.35) !important; border-color: rgba(59, 130, 246, 0.55) !important; }
.dark .status-flight { background: rgba(96, 165, 250, 0.35) !important; border-color: rgba(96, 165, 250, 0.55) !important; }
.dark .status-flight-booked { background: rgba(16, 185, 129, 0.35) !important; border-color: rgba(16, 185, 129, 0.55) !important; }
.dark .status-flight-not-booked { background: rgba(248, 113, 113, 0.35) !important; border-color: rgba(248, 113, 113, 0.55) !important; }
.dark .status-flight-proposed { background: rgba(251, 191, 36, 0.28) !important; border-color: rgba(251, 191, 36, 0.5) !important; }
.dark .status-flight-not-needed { background: rgba(148, 163, 184, 0.28) !important; border-color: rgba(148, 163, 184, 0.45) !important; color: #e2e8f0 !important; }
.dark .status-hotel { background: rgba(167, 139, 250, 0.35) !important; border-color: rgba(167, 139, 250, 0.55) !important; }
.dark .status-hotel-booked { background: rgba(16, 185, 129, 0.35) !important; border-color: rgba(16, 185, 129, 0.55) !important; }
.dark .status-hotel-not-booked { background: rgba(248, 113, 113, 0.35) !important; border-color: rgba(248, 113, 113, 0.55) !important; }
.dark .status-hotel-proposed { background: rgba(251, 191, 36, 0.28) !important; border-color: rgba(251, 191, 36, 0.5) !important; }
.dark .status-hotel-no-stay { background: rgba(45, 212, 191, 0.28) !important; border-color: rgba(45, 212, 191, 0.45) !important; }
.dark .status-eccr-unavailable { background: rgba(148, 163, 184, 0.25) !important; border-color: rgba(148, 163, 184, 0.4) !important; color: #e2e8f0 !important; }
.dark .status-eccr-not-booked { background: rgba(248, 113, 113, 0.35) !important; border-color: rgba(248, 113, 113, 0.55) !important; color: #fee2e2 !important; }
.dark .status-eccr-available { background: rgba(251, 191, 36, 0.3) !important; border-color: rgba(251, 191, 36, 0.5) !important; color: #fef3c7 !important; }
.dark .status-eccr-booked { background: rgba(34, 197, 94, 0.28) !important; border-color: rgba(34, 197, 94, 0.5) !important; color: #bbf7d0 !important; }
.dark .detail-subtext {
    color: #cbd5f5 !important;
}
.dark .upcoming-condensed {
    background: rgba(35, 41, 62, 0.96) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.dark .condensed-title,
.dark .condensed-route,
.dark .condensed-date {
    color: #f5f5ff !important;
}
.dark .condensed-meta {
    color: #d1d5db !important;
}
.dark .form-section,
.dark .form-group,
.dark .form-field,
.dark .split-group {
    background: transparent !important;
    color: #f1f1f1 !important;
}
.dark input,
.dark select,
.dark textarea {
    background: #232946 !important;
    color: #f1f1f1 !important;
    border-color: #444 !important;
}
.dark input:disabled,
.dark select:disabled,
.dark textarea:disabled {
    background: #232946 !important;
    color: #888 !important;
}
.dark .btn-primary,
.dark .btn-secondary {
    background: #232946 !important;
    color: #ffe066 !important;
    border: 1px solid #ffe066 !important;
}
.dark .btn-primary:hover,
.dark .btn-secondary:hover {
    background: #ffe066 !important;
    color: #232946 !important;
}
.dark .toast {
    background: #333 !important;
    color: #ffe066 !important;
}
.dark .no-data {
    color: #b0b3b8 !important;
}
/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Checkbox Styles */
.checkbox-group {
    margin: 1rem 0;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: #1f2937;
    font-weight: 500;
    user-select: none;
    line-height: 1.1;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    position: relative;
}

.checkbox-label input[type="checkbox"]::after {
    content: '';
    width: 6px;
    height: 10px;
    border-right: 2px solid transparent;
    border-bottom: 2px solid transparent;
    transform: rotate(45deg);
    transition: border-color 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked {
    background: #667eea;
    border-color: #5a67d8;
}

.checkbox-label input[type="checkbox"]:checked::after {
    border-color: #fff;
}

.checkbox-label input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(102, 126, 234, 0.35);
    outline-offset: 2px;
}

select.status-disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.dark select.status-disabled {
    opacity: 0.55;
}

.dark .checkbox-label {
    color: #f9fafc !important;
}

.dark .checkbox-label input[type="checkbox"] {
    background: rgba(30, 34, 45, 0.95);
    border-color: rgba(129, 140, 248, 0.7);
}

.dark .checkbox-label input[type="checkbox"]:checked {
    background: rgba(129, 140, 248, 0.85);
    border-color: rgba(129, 140, 248, 1);
}

.dark .checkbox-label input[type="checkbox"]:checked::after {
    border-color: #f9fafc;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #0f172a; /* Slate 900 */
    background: #f8fafc; /* Slate 50 */
    overflow-x: hidden;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
}

/* App Container */
.app-container {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin: 0 auto;
    background: #f1f5f9;
    position: relative;
    -webkit-transform: translateZ(0); /* Hardware acceleration */
    transform: translateZ(0);
}

/* Header */
.app-header {
    background: #f8fafc;
    color: #0f172a;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    z-index: 50;
}

.header-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    /* Create space for left theme btn and right concept/version */
    padding: 0 3rem; 
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: #0f172a;
}

.app-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    margin-top: 0.1rem;
}

.concept-switcher {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.concept-select {
    background: transparent;
    border: none;
    padding: 0.5rem;
    color: #64748b;
    font-size: 0; /* Hide text on mobile */
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6h16M4 12h16M4 18h16'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1.25rem;
    -webkit-appearance: none;
    appearance: none;
}

.concept-select:focus {
    outline: none;
    opacity: 0.7;
}

.concept-label {
    display: none;
}

.app-version {
    display: none; /* Hide version on mobile header to clean up */
}

/* Dark Mode Overrides for Header */
.dark .app-header {
    background: #1e293b !important;
    border-bottom-color: #334155;
}

.dark .app-title {
    color: #f1f5f9;
}

.dark .app-subtitle {
    color: #94a3b8;
}

.dark .concept-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6h16M4 12h16M4 18h16'/%3E%3C/svg%3E");
}

@media (min-width: 641px) {
    .app-header {
        padding: 1.25rem 1rem;
        justify-content: center;
    }

    .header-branding {
        padding: 0;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
    
    .app-subtitle {
        font-size: 1rem;
    }
    
    .concept-select {
        width: auto;
        height: auto;
        font-size: 0.75rem;
        background-color: #f1f5f9;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        padding: 0.35rem 0.6rem;
        color: #334155;
        background-image: none; /* Restore default select on Desktop */
        -webkit-appearance: auto;
        appearance: auto;
    }
    
    .app-version {
        display: block;
        position: absolute;
        top: 0.5rem;
        right: 1rem;
        font-size: 0.65rem;
        color: #94a3b8;
    }
    
    .concept-switcher {
        top: auto;
        bottom: 0.75rem;
        right: 1.5rem;
        transform: none;
    }
}


/* Main Content */
.main-content {
    flex: 1;
    padding: 1rem;
    padding-bottom: calc(5rem + env(safe-area-inset-bottom)); /* Space for bottom nav + safe area */
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    opacity: 0;
    pointer-events: none;
}

.screen.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e1e5e9;
    display: none; /* Hidden by default (Desktop) */
    justify-content: space-around;
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    padding-left: max(0rem, env(safe-area-inset-left));
    padding-right: max(0rem, env(safe-area-inset-right));
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    height: 60px;
}

main.main-content {
    flex: 1 1 auto;
    padding-bottom: 80px; /* Ensure content is not hidden behind nav */
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    min-width: 60px;
}

.nav-btn:hover,
.nav-btn.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.nav-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.nav-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.5);
}

.nav-icon {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-text {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Sidebar Navigation */
/* Sidebar Navigation */
/* Sidebar Navigation */
.sidebar-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 60px; /* Slightly wider to match button padding */
    background: #fff;
    border-right: 1px solid #e1e5e9;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: width 0.2s;
    padding-bottom: 1rem; /* Padding at bottom for theme button */
}

/* Ensure consistent button sizing */
.sidebar-nav .nav-btn,
.sidebar-nav .theme-toggle-btn {
    width: 100%;
    /* margin-inline: auto; Removed this, kept left align */
    display: flex;
    flex-direction: row; /* Row based for desktop */
    align-items: center;
    justify-content: flex-start;
    padding: 0.75rem 0.8rem; /* Consistent padding */
    color: #6b7280;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-size: 1rem;
    box-shadow: none;
    /* No margin-top auto on individual buttons here, handled by container or spacer if needed */
}

/* Avoid oversized active background when sidebar is collapsed */
.sidebar-nav .nav-btn:hover,
.sidebar-nav .nav-btn.active {
    background: transparent;
}

/* Only show active background when sidebar is expanded */
.sidebar-nav.open .nav-btn:hover,
.sidebar-nav.open .nav-btn.active {
    background: rgba(102, 126, 234, 0.08);
    color: #667eea;
}

/* Sidebar Theme Toggle specific placement */
.sidebar-nav .theme-toggle-btn {
    margin-top: 0; /* Put together with others */
}

.sidebar-nav .nav-icon,
.sidebar-nav .theme-toggle-btn .theme-icon {
    font-size: 1.3rem;
    margin-right: 0.75rem;
    min-width: 24px;
    text-align: center; /* Center icon in its slot */
    display: flex;
    justify-content: center;
}
    /* Removed stray display flex here */
.sidebar-nav .nav-text {
    font-size: 1rem;
    font-weight: 500;
    display: none;
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden; /* Ensure no bleed */
    text-overflow: ellipsis; 
}
.sidebar-nav.open .nav-text {
    display: inline-block; 
}

/* Note: Styles handled by shared rules above. Removed explicit duplicates to prevent conflicts. */
.sidebar-nav .theme-toggle-btn.theme-toggle-btn { /* Specificity bump */
    /* Ensure padding and layout match EXACTLY */
    padding: 0.75rem 0.8rem;
    margin-top: 0; /* Remove auto margin */
    margin-bottom: 0;
    width: 100%;
}

.sidebar-nav .theme-toggle-btn .theme-icon {
    /* Handled by shared rule */
}

/* Main content padding for sidebar */
.app-container {
        padding-left: 56px;
        transition: padding-left 0.2s;
}
.sidebar-nav.open ~ .app-container {
        padding-left: 180px;
}

/* Responsive: Reduce sidebar width on small screens */
@media (max-width: 600px) {
    .concept-switcher {
        position: static;
        margin-top: 0.65rem;
        justify-content: center;
    }
    .concept-select {
        font-size: 0.85rem;
        padding: 0.35rem 0.7rem;
        width: auto;
        height: auto;
        background-color: #f1f5f9;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        color: #334155;
        background-image: none;
        -webkit-appearance: auto;
        appearance: auto;
    }
    .sidebar-nav {
        width: 44px;
    }
    .sidebar-nav.open {
        width: 120px;
    }
    .app-container {
        padding-left: 44px;
    }
    .sidebar-nav.open ~ .app-container {
        padding-left: 120px;
    }
    .sidebar-links {
        align-items: flex-start;
    }
    .sidebar-nav .nav-btn {
        padding: 0.6rem 0.5rem;
        font-size: 0.98rem;
    }
    .sidebar-nav .nav-icon {
        font-size: 1.15rem;
        margin-right: 0.5rem;
        min-width: 20px;
    }
    .burger-menu {
        width: 28px;
        height: 28px;
        margin-left: 0.2rem;
        left: 0;
        right: auto;
    }
    .burger-bar {
        width: 16px;
        height: 2.5px;
    }
    #home-screen {
        gap: 1.1rem;
    }
    #home-screen.screen.active {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }
    .status-card,
    .trip-card,
    .stat-item {
        padding: 1.25rem;
    }
    .trip-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    .trip-dates {
        text-align: left;
    }
    .quick-stats {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

/* Remove old bottom nav styles if present */
/* .bottom-nav { display: none !important; } */

/* Cards and Status */
#home-screen {
    gap: 1.5rem;
}

#home-screen.screen.active {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.current-status,
.next-transfer {
    margin-bottom: 0;
}

.current-status h2,
.next-transfer h2 {
    color: #1f2937;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.status-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
}

.status-card.eccr-warning,
.trip-card.eccr-warning {
    border-color: #f97316;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    box-shadow: 0 8px 22px rgba(249, 115, 22, 0.18);
}

.status-card.eccr-conflict,
.trip-card.eccr-conflict {
    border-color: #dc2626;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    box-shadow: 0 10px 28px rgba(220, 38, 38, 0.22);
}

.status-card.eccr-available,
.trip-card.eccr-available {
    border-color: #0284c7;
    background: linear-gradient(135deg, #eff6ff, #e0f2fe);
    box-shadow: 0 10px 26px rgba(2, 132, 199, 0.18);
}

.trip-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
    color: #111827;
}

.trip-card.current {
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
    background: #f0fdf4; /* Emerald 50 - Light green tint for visibility */
}

.trip-card.current::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981, #34d399);
}

.status-card,
.trip-card,
.stat-item {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

#on-hold-container {
    display: flex;
    flex-direction: column;
}

.on-hold-card {
    border: 1px dashed rgba(148, 163, 184, 0.7);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: rgba(248, 250, 252, 0.8);
}

.on-hold-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.on-hold-route {
    font-weight: 600;
    color: #1f2937;
}

.on-hold-dates {
    font-size: 0.85rem;
    color: #4b5563;
}

.on-hold-status {
    font-size: 0.85rem;
    font-weight: 600;
    color: #b91c1c;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.on-hold-status::before {
    content: '\26A0';
    font-size: 0.9rem;
}

.on-hold-body {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.on-hold-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.on-hold-card .detail-section {
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
}

.status-card:hover,
.trip-card:hover,
.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    border-color: rgba(102, 126, 234, 0.35);
}

.trip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.trip-route {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
}

.trip-dates {
    font-size: 0.85rem;
    color: #6b7280;
    text-align: right;
}

.trip-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.trip-status.status-upcoming { background: #1e40af; color: #ffffff; }
.trip-status.status-current { background: #065f46; color: #ffffff; }
.trip-status.status-completed { background: #374151; color: #ffffff; }
.trip-status.status-custom { background: #4c1d95; color: #ffffff; }

.trip-details {
    display: grid;
    gap: 1rem;
}

.detail-section {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.section-flight { background-color: #fef3c7; border-left: 4px solid #f59e0b; }
.section-hotel { background-color: #e0e7ff; border-left: 4px solid #6366f1; }
.section-cabin { background-color: #fee2e2; border-left: 4px solid #dc2626; }
.section-ship { background-color: #d1fae5; border-left: 4px solid #10b981; }
.section-next { background-color: #e0f2fe; border-left: 4px solid #38bdf8; }

.detail-section.detail-conflict {
    border: 1px solid rgba(220, 38, 38, 0.35);
    background: linear-gradient(120deg, #fef2f2 0%, #fee2e2 100%);
}

.detail-section.detail-alert {
    border: 1px solid rgba(249, 115, 22, 0.35);
    background: linear-gradient(120deg, #fff7ed 0%, #ffedd5 100%);
}

.detail-section.detail-highlight {
    border: 1px solid rgba(59, 130, 246, 0.35);
    background: linear-gradient(120deg, #eff6ff 0%, #dbeafe 100%);
}

.detail-section.detail-muted {
    opacity: 0.85;
}

.detail-icon {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.detail-content {
    flex: 1;
}

.detail-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #111827;
}

.detail-info {
    color: #6b7280;
    font-size: 0.85rem;
}

.trip-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
    background: #1f2937;
    color: #f9fafb;
    border: 1px solid rgba(15, 23, 42, 0.2);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15);
}

.status-badge .badge-key {
    opacity: 0.85;
}

.status-badge .badge-value {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
}

.status-badge .badge-warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.25rem;
    font-size: 0.85em;
}

.status-badge .badge-text {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.status-approval { background: #4338ca; border-color: rgba(67, 56, 202, 0.25); }
.status-approval-approved { background: #047857; border-color: rgba(4, 120, 87, 0.35); }
.status-approval-pending { background: #b45309; border-color: rgba(180, 83, 9, 0.35); }
.status-approval-planned { background: #2563eb; border-color: rgba(37, 99, 235, 0.35); }

.status-flight { background: #1d4ed8; border-color: rgba(29, 78, 216, 0.35); }
.status-flight-booked { background: #047857; border-color: rgba(4, 120, 87, 0.35); }
.status-flight-not-booked { background: #b91c1c; border-color: rgba(185, 28, 28, 0.35); }
.status-flight-proposed { background: #b45309; border-color: rgba(180, 83, 9, 0.35); }
.status-flight-not-needed { background: #e5e7eb; border-color: rgba(148, 163, 184, 0.45); color: #1f2937; }

.status-hotel { background: #6d28d9; border-color: rgba(109, 40, 217, 0.35); }
.status-hotel-booked { background: #047857; border-color: rgba(4, 120, 87, 0.35); }
.status-hotel-not-booked { background: #b91c1c; border-color: rgba(185, 28, 28, 0.35); }
.status-hotel-proposed { background: #b45309; border-color: rgba(180, 83, 9, 0.35); }
.status-hotel-no-stay { background: #0f766e; border-color: rgba(15, 118, 110, 0.35); }

.status-eccr-unavailable { background: #f3f4f6; border-color: rgba(148, 163, 184, 0.35); color: #374151; }
.status-eccr-not-booked { background: #fee2e2; border-color: rgba(248, 113, 113, 0.45); color: #991b1b; }
.status-eccr-available { background: #fef3c7; border-color: rgba(251, 191, 36, 0.45); color: #92400e; }
.status-eccr-booked { background: #d1fae5; border-color: rgba(16, 185, 129, 0.4); color: #065f46; }

.detail-content {
    display: grid;
    gap: 0.25rem;
}

.detail-meta {
    font-size: 0.75rem;
    font-weight: 600;
}

.detail-subtext {
    font-size: 0.75rem;
    color: #4b5563;
}

.deadline-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: help;
}

.deadline-badge .deadline-main {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.deadline-badge .deadline-tooltip {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.35rem);
    transform: translateX(-50%);
    min-width: 12rem;
    max-width: 18rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
    z-index: 10;
    text-align: left;
    pointer-events: none;
}

.deadline-badge .deadline-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
}

.deadline-badge:hover .deadline-tooltip,
.deadline-badge:focus-visible .deadline-tooltip {
    display: block;
}

.deadline-ok { background: #e0f2fe; color: #0369a1; }
.deadline-warning { background: #fef3c7; color: #92400e; }
.deadline-due { background: #fee2e2; color: #b91c1c; }
.deadline-overdue { background: #fecdd3; color: #9f1239; }

.dark .deadline-badge {
    background: rgba(148, 163, 184, 0.2);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #e2e8f0;
}

.dark .deadline-badge .deadline-tooltip {
    background: rgba(30, 41, 59, 0.95);
    color: #f8fafc;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.45);
}

.dark .deadline-badge .deadline-tooltip::after {
    border-color: rgba(30, 41, 59, 0.95) transparent transparent transparent;
}

.dark .deadline-ok {
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(59, 130, 246, 0.45);
    color: #dbeafe;
}

.dark .deadline-warning {
    background: rgba(251, 191, 36, 0.24);
    border-color: rgba(251, 191, 36, 0.45);
    color: #fef3c7;
}

.dark .deadline-due {
    background: rgba(248, 113, 113, 0.28);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fee2e2;
}

.dark .deadline-overdue {
    background: rgba(236, 72, 153, 0.28);
    border-color: rgba(236, 72, 153, 0.45);
    color: #fbcfe8;
}

.upcoming-condensed {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
}

.condensed-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.condensed-list {
    list-style: none;
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.condensed-item {
    display: grid;
    gap: 0.35rem;
}

.condensed-route {
    font-weight: 600;
    color: #111827;
}

.condensed-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    font-size: 0.8rem;
    color: #4b5563;
}

.condensed-date {
    font-weight: 600;
    color: #1f2937;
    margin-right: 0.5rem;
}

.condensed-tag {
    background: #e5e7eb;
    color: #1f2937;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.condensed-approval-approved { background: #dcfce7; color: #166534; }
.condensed-approval-pending { background: #fef3c7; color: #92400e; }
.condensed-approval-planned { background: #e0f2fe; color: #1d4ed8; }

.condensed-flight-booked,
.condensed-hotel-booked { background: #dcfce7; color: #166534; }

.condensed-flight-not-booked,
.condensed-hotel-not-booked { background: #fee2e2; color: #b91c1c; }

.condensed-flight-proposed,
.condensed-hotel-proposed { background: #fef3c7; color: #92400e; }

.condensed-flight-not-needed { background: #e5e7eb; color: #374151; }

.condensed-hotel-no-stay { background: #e0f2fe; color: #0369a1; }
.condensed-eccr-unavailable { background: #e5e7eb; color: #4b5563; border: 1px dashed rgba(148, 163, 184, 0.8); }
.condensed-eccr-not-booked { background: #fee2e2; color: #b91c1c; }
.condensed-eccr-available { background: #fef3c7; color: #92400e; }
.condensed-eccr-booked { background: #dcfce7; color: #166534; }

.condensed-deadline {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.condensed-ok { background: #e0f2fe; color: #0369a1; }
.condensed-warning { background: #fef3c7; color: #92400e; }
.condensed-due { background: #fee2e2; color: #b91c1c; }
.condensed-overdue { background: #fecdd3; color: #9f1239; }

.dark .condensed-list {
    border-color: rgba(255, 255, 255, 0.08);
}

.dark .condensed-deadline {
    background: rgba(148, 163, 184, 0.2) !important;
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
    color: #e2e8f0 !important;
}

.dark .condensed-ok {
    background: rgba(59, 130, 246, 0.22) !important;
    border-color: rgba(59, 130, 246, 0.45) !important;
    color: #dbeafe !important;
}

.dark .condensed-warning {
    background: rgba(251, 191, 36, 0.24) !important;
    border-color: rgba(251, 191, 36, 0.45) !important;
    color: #fef3c7 !important;
}

.dark .condensed-due {
    background: rgba(248, 113, 113, 0.28) !important;
    border-color: rgba(248, 113, 113, 0.45) !important;
    color: #fee2e2 !important;
}

.dark .condensed-overdue {
    background: rgba(236, 72, 153, 0.28) !important;
    border-color: rgba(236, 72, 153, 0.45) !important;
    color: #fbcfe8 !important;
}

.dark .condensed-tag {
    background: rgba(148, 163, 184, 0.25) !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
}

.dark .condensed-approval-approved { background: rgba(16, 185, 129, 0.25) !important; border-color: rgba(16, 185, 129, 0.45) !important; color: #bbf7d0 !important; }
.dark .condensed-approval-pending { background: rgba(251, 191, 36, 0.22) !important; border-color: rgba(251, 191, 36, 0.4) !important; color: #fef3c7 !important; }
.dark .condensed-approval-planned { background: rgba(59, 130, 246, 0.25) !important; border-color: rgba(59, 130, 246, 0.45) !important; color: #dbeafe !important; }

.dark .condensed-flight-booked,
.dark .condensed-hotel-booked {
    background: rgba(16, 185, 129, 0.25) !important;
    border-color: rgba(16, 185, 129, 0.45) !important;
    color: #bbf7d0 !important;
}

.dark .condensed-flight-not-booked,
.dark .condensed-hotel-not-booked {
    background: rgba(248, 113, 113, 0.25) !important;
    border-color: rgba(248, 113, 113, 0.45) !important;
    color: #fee2e2 !important;
}

.dark .condensed-flight-proposed,
.dark .condensed-hotel-proposed {
    background: rgba(251, 191, 36, 0.22) !important;
    border-color: rgba(251, 191, 36, 0.4) !important;
    color: #fef3c7 !important;
}

.dark .condensed-eccr-unavailable {
    background: rgba(148, 163, 184, 0.28) !important;
    border-color: rgba(148, 163, 184, 0.45) !important;
    color: #e2e8f0 !important;
}
.dark .condensed-eccr-not-booked {
    background: rgba(248, 113, 113, 0.28) !important;
    border-color: rgba(248, 113, 113, 0.5) !important;
    color: #fee2e2 !important;
}
.dark .condensed-eccr-available {
    background: rgba(251, 191, 36, 0.28) !important;
    border-color: rgba(251, 191, 36, 0.5) !important;
    color: #fef3c7 !important;
}
.dark .condensed-eccr-booked {
    background: rgba(16, 185, 129, 0.28) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
    color: #bbf7d0 !important;
}

.dark .condensed-flight-not-needed {
    background: rgba(148, 163, 184, 0.25) !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
    color: #e2e8f0 !important;
}

.dark .condensed-hotel-no-stay {
    background: rgba(45, 212, 191, 0.22) !important;
    border-color: rgba(45, 212, 191, 0.4) !important;
    color: #ccfbf1 !important;
}

.dark .condensed-deadline {
    background: rgba(148, 163, 184, 0.25) !important;
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
    color: #f8fafc !important;
}

.dark .condensed-ok { background: rgba(59, 130, 246, 0.25) !important; border-color: rgba(59, 130, 246, 0.45) !important; color: #dbeafe !important; }
.dark .condensed-warning { background: rgba(251, 191, 36, 0.22) !important; border-color: rgba(251, 191, 36, 0.4) !important; color: #fef3c7 !important; }
.dark .condensed-due { background: rgba(248, 113, 113, 0.25) !important; border-color: rgba(248, 113, 113, 0.45) !important; color: #fee2e2 !important; }
.dark .condensed-overdue { background: rgba(244, 114, 182, 0.25) !important; border-color: rgba(244, 114, 182, 0.45) !important; color: #fce7f3 !important; }

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
    margin-top: 0;
    align-self: flex-start;
}

.stat-item {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #4b5563;
    font-weight: 500;
}

/* Forms */
.trip-form {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
}
.dark .trip-form {
    background: #1f2430 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45) !important;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}
.dark .form-section {
    background: rgba(36, 41, 54, 0.96) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px;
    padding: 1.5rem !important;
    margin-bottom: 1.5rem !important;
}

.form-section:last-of-type {
    border-bottom: none;
}
.dark .form-section:last-of-type {
    border: none !important;
}

.form-section h3 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}
.dark .form-section h3 {
    color: #c7d2ff !important;
}

.form-group {
    margin-bottom: 1rem;
}

.form-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #4b5563;
}
.dark .form-hint {
    color: #cbd5f5 !important;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}
.dark .form-group label {
    color: #f0f4ff !important;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #e2e8f0; /* Slate 200 */
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.15s ease;
    background: #fff;
    color: #1e293b;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6; /* Blue 500 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .form-section .form-group + .form-group {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1rem;
}
.dark .form-group input,
.dark .form-group textarea,
.dark .form-group select {
    background: #1e293b !important; /* Slate 800 */
    color: #f8fafc !important;
    border: 1px solid #334155 !important; /* Slate 700 */
    box-shadow: none;
}
.dark .form-group input::placeholder,
.dark .form-group textarea::placeholder {
    color: #94a3b8 !important;
}
.dark .form-group input:focus,
.dark .form-group textarea:focus {
    border-color: #a5b4fc !important;
    box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.25) !important;
}

/* Improve date inputs on mobile */
.form-group input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
}

.form-group input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background-color: #fff;
    color: #1e293b;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.15s ease;
    cursor: pointer;
    /* Custom arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-small,
.btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-height: 44px; /* Touch-friendly */
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: #e5e7eb;
    color: #374151;
}

.btn-small:hover {
    background: #d1d5db;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f3f4f6;
}

/* Timeline */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.timeline-header h2 {
    color: #374151;
    font-size: 1.5rem;
}

.timeline-actions {
    display: flex;
    gap: 0.5rem;
}

.timeline-container {
    position: relative;
}

.timeline-line {
    position: absolute;
    left: 1rem;
    top: 2rem;
    bottom: 2rem;
    width: 2px;
    background: #e5e7eb;
    z-index: 1;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    margin-left: 2.5rem;
}

.timeline-dot {
    position: absolute;
    left: -2.25rem;
    top: 1.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #667eea;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #e5e7eb;
    z-index: 2;
}

.timeline-dot.current {
    background: #10b981;
    box-shadow: 0 0 0 2px #10b981, 0 0 0 4px #d1fae5;
}

.timeline-dot.completed {
    background: #6b7280;
}

/* Trip Actions */
.trip-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

.btn-edit,
.btn-delete {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit {
    background: #f3f4f6;
    color: #374151;
}

.btn-edit:hover {
    background: #e5e7eb;
}

.btn-delete {
    background: #fee2e2;
    color: #dc2626;
}

.btn-delete:hover {
    background: #fecaca;
}

/* Utilities */
.no-data {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 2rem;
}

.hidden {
    display: none !important;
}

.text-center { text-align: center; }
.text-muted { color: #6b7280; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

/* Loading Spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 6rem;
    left: 1rem;
    right: 1rem;
    background: #374151;
    color: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateY(0);
}

.toast.success {
    background: #10b981;
}

.toast.warning {
    background: #f59e0b;
}

.toast.error {
    background: #ef4444;
}

/* Countdown Display */
.countdown {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.countdown.urgent {
    background: #fecaca;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Keyboard handling for mobile */
body.keyboard-open .bottom-nav {
    display: none;
}

body.keyboard-open .main-content {
    padding-bottom: 1rem;
}

/* WebView optimizations */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Prevent text selection on UI elements */
.nav-btn,
.btn-primary,
.btn-secondary,
.btn-small,
.trip-actions button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection in form inputs and content areas */
.form-group input,
.form-group textarea,
.trip-card,
.detail-info {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Responsive Design */
@media (min-width: 768px) {
    .app-container {
        max-width: 768px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
    
    .bottom-nav {
        max-width: 768px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .form-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

@media (min-width: 960px) {
    .app-container {
        max-width: 1040px;
    }
    #home-screen.screen.active {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        grid-template-areas:
            "current quick"
            "next quick"
            "past past";
        align-items: start;
    }
    #home-screen .current-status { grid-area: current; }
    #home-screen .next-transfer { grid-area: next; }
    #home-screen .past-trips { grid-area: past; }
    #home-screen .quick-stats {
        grid-area: quick;
        position: sticky;
        top: calc(1.5rem + env(safe-area-inset-top));
    }
}

@media (min-width: 1024px) {
    .main-content {
        padding: 2rem;
        padding-bottom: 5rem;
    }
    .app-container {
        max-width: 1180px;
    }
    
    .trip-details {
        grid-template-columns: 1fr 1fr;
    }
    
}

/* =========================================
   MOBILE FIRST OPTIMIZATIONS (v0.8.1)
   ========================================= */
@media (max-width: 640px) {
    /* Container & Layout */
    .app-container {
        padding: 0;
        background: #f8fafc; /* Ensure background fills on bounce */
    }
    
    .main-content {
        padding: 0.75rem;
        padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    }

    /* Header Compactness */
    .app-header {
        padding: 0.75rem 1rem;
    }
    
    .app-title {
        font-size: 1.1rem;
    }
    
    /* Trip Card Compression */
    .trip-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
        border-radius: 12px;
    }
    
    .trip-header {
        margin-bottom: 0.5rem;
        /* Ensure title doesn't break weirdly */
        align-items: center; 
    }
    
    .trip-route {
        font-size: 1rem;
        font-weight: 700;
    }
    
    .trip-dates {
        font-size: 0.75rem;
    }

    /* Badges / Pills Optimization */
    .trip-meta-row {
        gap: 0.35rem;
        margin-bottom: 0.75rem;
    }
    
    .status-badge {
        padding: 0.25rem 0.5rem; /* Tighter padding */
        font-size: 0.65rem;      /* Smaller text */
        border-radius: 6px;      /* Softer rect to save horizontal space vs pill shape */
        height: auto;
        line-height: 1.2;
    }

    /* .status-badge .badge-key {
        display: none; 
    } */

    /* Details Sections */
    .trip-details {
        gap: 0.5rem;
    }
    
    .detail-section {
        padding: 0.6rem;
        font-size: 0.85rem;
        border-left-width: 3px; /* Slightly thinner border */
    }
    
    .detail-icon {
        margin-right: 0.5rem;
        font-size: 1rem;
    }

    /* Form Fields - Better Touch Targets, Less Waste */
    .form-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 0.35rem;
    }
    
    .form-group input, 
    .form-group select {
        padding: 0.6rem 0.75rem; /* Comfortable touch target */
        font-size: 1rem; /* Prevent iOS zoom */
    }
    
    /* Bottom Nav */
    .bottom-nav {
        height: auto;
        padding: 0.5rem;
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
        max-width: 900px; /* Limit width */
        margin: 0 auto;   /* Center */
        right: 0;         /* Ensure it spans for centering logic */
        align-items: center; /* Vertical center items */
        justify-content: space-between; /* Add this */
    }

    .bottom-nav .nav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .nav-icon {
        font-size: 1.25rem;
        margin-bottom: 2px;
    }
    
    .nav-text {
        font-size: 0.65rem;
    }
}




@media (max-width: 640px) {
    .sidebar-nav, 
    .burger-menu {
        display: none !important;
    }
    
    .bottom-nav {
        display: flex !important;
    }
    
    /* Ensure no left padding remains */
    .app-container {
        padding-left: 0 !important;
    }
}



/* Dark Mode Bottom Nav */
.dark .bottom-nav {
    background: #1e293b !important; /* Dark Slate */
    border-top-color: #334155 !important;
}

.dark .bottom-nav .nav-btn {
    color: #94a3b8;
}

.dark .bottom-nav .nav-btn.active {
    color: #38bdf8; /* Sky Blue */
    background: transparent !important; /* Remove background highlight on mobile if present */
}

.dark .bottom-nav .nav-btn.active .nav-text {
    color: #38bdf8;
    font-weight: 600;
}


/* Header Theme Button (Mobile) */
.header-theme-btn {
    display: none !important;
}

/* Bottom Nav Theme Button */
.bottom-nav .theme-toggle-btn {
    margin: 0;
    width: auto;
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: inherit;
    flex: 1;
}

.bottom-nav .theme-toggle-btn .theme-icon {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.bottom-nav .theme-toggle-btn .nav-text {
    font-size: 0.65rem;
}

.header-theme-btn:focus {
    outline: none;
}

@media (max-width: 640px) {
    .header-theme-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 50%;
    }
    
    .header-theme-btn:active {
        background-color: rgba(0,0,0,0.05);
    }
    
    .dark .header-theme-btn:active {
        background-color: rgba(255,255,255,0.05);
    }
}


/* =========================================
   Mobile Optimizations for Other Pages
   Add Trip, One Hold, Timeline
   ========================================= */
@media (max-width: 640px) {
    /* Add Trip Form */
    .trip-form {
        padding: 1rem;
        border-radius: 12px;
        box-shadow: none;
        border: none;
        background: transparent;
    }
    
    /* Make sections feel like cards */
    .form-section {
        background: #fff;
        padding: 1rem;
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        margin-bottom: 0.75rem;
        border: 1px solid #e2e8f0;
    }

    .dark .trip-form {
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    .dark .form-section {
        background: #1e293b !important;
        border-color: #334155 !important;
    }

    /* On Hold Cards */
    .on-hold-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

    .on-hold-header {
        flex-direction: column; /* Stack header on very small screens if needed, or keep row */
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .on-hold-dates {
        font-size: 0.75rem;
    }

    /* Timeline */
    .timeline-container {
        padding-left: 0.25rem; /* Minimal padding */
    }
    
    .timeline-line {
        left: 0.75rem;    /* Move line to left edge */
        width: 1px;       /* Thinner line */
    }
    
    .timeline-item {
        margin-left: 0;   /* Reset margin */
        padding-left: 1.75rem; /* Space for dot */
        margin-bottom: 1rem;
    }
    
    .timeline-dot {
        left: 0.45rem;     /* Align with line */
        width: 10px;      /* Smaller dot */
        height: 10px;
        top: 1.25rem;
        border-width: 2px;
    }
    
    .timeline-item .trip-card {
        margin-bottom: 0; 
    }
}


/* =========================================
   Timeline Compactness (Mobile Fix)
   ========================================= */
@media (max-width: 640px) {
    /* Super Compact Timeline Cards */
    .timeline-item .trip-card {
        padding: 0.75rem !important; /* Force tight padding */
        gap: 0.5rem;
    }
    
    .timeline-item .trip-header {
        margin-bottom: 0.25rem;
    }
    
    .timeline-item .trip-route {
        font-size: 0.95rem; /* Slightly smaller title */
    }
    
    .timeline-item .trip-dates {
        font-size: 0.7rem;
    }
    
    .timeline-item .trip-status { 
        margin-bottom: 0.5rem;
        padding: 0.15rem 0.5rem;
        font-size: 0.65rem;
        min-height: auto;
    }
    
    /* Make the inner details (flight, hotel, etc) very slim */
    .timeline-item .detail-section {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
        min-height: auto;
    }

    .timeline-item .detail-icon {
        font-size: 0.9rem;
        margin-right: 0.4rem;
    }
    
    .timeline-item .detail-title {
        font-size: 0.8rem;
        margin-bottom: 0;
    }
    
    .timeline-item .detail-info {
        font-size: 0.75rem;
    }
    
    /* Compact Buttons */
    .timeline-item .trip-actions {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    .timeline-item .btn-edit,
    .timeline-item .btn-delete {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
}

