/* ============================================
   AUTO-HIDING HEADER (MOBILE ONLY)
   ============================================ */

@media (max-width: 1023px) {
    #main-header h1 {
        transform: translateY(-100%);
        opacity: 0;
        transition: all 0.3s ease-in-out;
        max-height: 0;
        overflow: hidden;
        margin-bottom: 0 !important;
    }

    #main-header.header-show-title h1 {
        transform: translateY(0);
        opacity: 1;
        max-height: 100px;
        margin-bottom: 0.25rem !important;
    }
    /* Reduce gap between title and buttons */
    #main-header .flex.flex-col {
        gap: 0.25rem !important;
    }
}
/* ============================================
   MOBILE-FIRST STYLES
   Base styles are for mobile, enhanced with min-width media queries
   ============================================ */

/* RTL Support - Mobile Base */
[dir="rtl"] .sidebar {
    border-left: 1px solid #e5e7eb;
    border-right: none;
}

.dark [dir="rtl"] .sidebar {
    border-left-color: #334155;
}

/* Video Container */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Recommended Badge - Mobile Base */
.recommended-badge {
    position: absolute;
    top: -8px;
    right: -8px;
}

[dir="rtl"] .recommended-badge {
    right: auto;
    left: -8px;
}

/* OS Item */
.os-item {
    transition: all 0.2s ease;
    position: relative;
}

.os-item:hover {
    transform: translateY(-2px);
}

/* Language Selector */
.language-selector {
    appearance: none;
    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-print-color-adjust: exact;
}

.dark .language-selector {
    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='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Selected Card */
.selected-card {
    border: 2px solid #8b5cf6;
    border-radius: 0.5rem;
}

/* Recommended Card */
.recommended-card {
    background-color: #f0fdf4;
    border-left: 4px solid #22c55e;
}

.dark .recommended-card {
    background-color: #052e16;
    border-left-color: #22c55e;
}

/* Chevron Transition */
.chevron-transition {
    transition: transform 0.2s ease;
}

/* Breadcrumb */
.breadcrumb {
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.breadcrumb a {
    color: #3b82f6;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: #6b7280;
}

/* Sticky Header */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

.dark .sticky-header {
    background-color: rgba(15, 23, 42, 0.95);
}

/* Attention Notice */
.attention-notice {
    font-weight: 600;
}

.dark .attention-notice {
    color: #e2e8f0;
}

/* Tooltip Icon */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #3b82f6;
    color: white;
    font-size: 10px;
    margin-left: 6px;
    cursor: help;
}

.dark .tooltip-icon {
    background-color: #1d4ed8;
}

/* Fallback Message */
.fallback-message {
    border-left: 4px solid #f59e0b;
    background-color: #fffbeb;
}

.dark .fallback-message {
    border-left-color: #f59e0b;
    background-color: #451a03;
}

/* Focus Styles for Accessibility */
button:focus, 
[type='button']:focus, 
[type='reset']:focus, 
[type='submit']:focus,
a:focus, 
select:focus, 
[tabindex="0"]:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

button:focus:not(:focus-visible) {
    outline: none;
}

button:focus-visible, 
[type='button']:focus-visible, 
[type='reset']:focus-visible, 
[type='submit']:focus-visible,
a:focus-visible, 
select:focus-visible, 
[tabindex="0"]:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Driver Item - Mobile First (Stacked Layout) */
.driver-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.driver-item:hover {
    background-color: rgba(243, 244, 246, 0.5);
}

.dark .driver-item:hover {
    background-color: rgba(55, 65, 81, 0.5);
}

.driver-info {
    flex-grow: 1;
    width: 100%;
}

.driver-name {
    font-weight: 500;
}

.recommended-driver .driver-name {
    font-weight: 600;
}

.driver-version {
    font-size: 0.875rem;
    color: #6b7280;
}

.dark .driver-version {
    color: #9ca3af;
}

/* Download Button - Mobile First (Full Width) */
.download-btn {
    padding: 0.375rem 0.75rem;
    background-color: #1a56db;
    color: white;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: background-color 0.2s;
    white-space: nowrap;
    margin-top: 0.5rem;
    width: 100%;
    position: relative;
}

.download-btn:hover {
    background-color: #1646b6;
}

.recommended-download-btn {
    animation: ring-glow 2s infinite;
}

/* Recommended Tag - Mobile Base */
.recommended-tag {
    position: absolute;
    top: -6px;
    right: 8px;
    background-color: #10b981;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 9999px;
    font-weight: 600;
    z-index: 10;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.recommended-tag::before {
    content: "✓";
    margin-right: 2px;
}

[dir="rtl"] .recommended-tag {
    right: auto;
    left: 8px;
}

[dir="rtl"] .recommended-tag::before {
    margin-right: 0;
    margin-left: 2px;
}

/* Video Download Button */
.video-download-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background-color: #1a56db;
    color: white;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    transition: background-color 0.2s;
}

.video-download-btn:hover {
    background-color: #1646b6;
}

.video-download-btn i {
    margin-right: 0.25rem;
}

/* Sidebar - Mobile Base (Full Width, Bottom Border) */
.sidebar {
    width: 100%;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

.dark .sidebar {
    border-bottom-color: #334155;
}

/* Mobile Video Container Improvements */
@media (max-width: 768px) {
    .video-container {
        padding-bottom: 56.25%;
        margin-bottom: 0.75rem;
    }
    
    #mobile-video-description {
        text-align: center;
        font-size: 0.875rem;
    }
}

/* ============================================
   TABLET AND DESKTOP STYLES
   Enhanced styles for larger screens (769px and up)
   ============================================ */

@media (min-width: 769px) {
    /* Sidebar - Desktop (Side Border) */
    .sidebar {
        width: auto;
        border-bottom: none;
        border-right: 1px solid #e5e7eb;
    }
    
    .dark .sidebar {
        border-bottom: none;
        border-right-color: #334155;
    }
    
    [dir="rtl"] .sidebar {
        border-right: none;
        border-left: 1px solid #e5e7eb;
    }
    
    .dark [dir="rtl"] .sidebar {
        border-left-color: #334155;
    }
    
    /* Driver Item - Desktop (Horizontal Layout) */
    .driver-item {
        flex-direction: row;
        align-items: center;
    }
    
    .driver-info {
        width: auto;
    }
    
    /* Download Button - Desktop (Inline) */
    .download-btn {
        margin-left: 0.5rem;
        margin-top: 0;
        width: auto;
    }
    
    /* Recommended Tag - Desktop */
    .recommended-tag {
        right: 16px;
        top: -8px;
    }
    
    [dir="rtl"] .recommended-tag {
        left: 16px;
    }
}

/* Remove extra spacing on mobile */
@media (max-width: 768px) {
    main > div:first-child {
        margin-bottom: 1rem;
    }
    
    .bg-white.dark\:bg-dark-800.rounded-lg.shadow-sm {
        margin-bottom: 1rem !important;
    }
}

/* Glowing effect for FPN and Email buttons */
@keyframes header-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(26, 86, 219, 0.5),
                    0 0 10px rgba(26, 86, 219, 0.3);
    }
    50% {
        box-shadow: 0 0 10px rgba(26, 86, 219, 0.8),
                    0 0 20px rgba(26, 86, 219, 0.5),
                    0 0 30px rgba(26, 86, 219, 0.3);
    }
}

.animate-header-glow {
    animation: header-glow 2s ease-in-out infinite;
}

.dark .animate-header-glow {
    animation: header-glow-dark 2s ease-in-out infinite;
}

@keyframes header-glow-dark {
    0%, 100% {
        box-shadow: 0 0 5px rgba(96, 165, 250, 0.5),
                    0 0 10px rgba(96, 165, 250, 0.3);
    }
    50% {
        box-shadow: 0 0 10px rgba(96, 165, 250, 0.8),
                    0 0 20px rgba(96, 165, 250, 0.5),
                    0 0 30px rgba(96, 165, 250, 0.3);
    }
}
/* ============================================
   MOBILE HEADER FIX - Compact & Space-Saving
   ============================================ */

@media (max-width: 768px) {
    /* Reduce header padding */
    header .container {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    /* Smaller title */
    header h1 {
        font-size: 1.25rem !important;
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    /* Compact spacing between rows */
    header .flex.flex-col {
        gap: 0.5rem !important;
    }
    
    /* ALL ITEMS IN ONE ROW - Email, FPN, Language, Dark Mode */
    header .flex.flex-wrap {
        justify-content: center !important;
        gap: 0.35rem !important;
        width: 100% !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        flex-direction: row !important;
    }
    
    /* Force everything to stay in one row */
    [dir="rtl"] header .flex.flex-wrap {
        flex-direction: row !important;
    }
    
    /* Email and FPN buttons - KEEP CONSISTENT SIZE */
    header a[href*="email"],
    header a[href*="fpn"] {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.78rem !important;
        flex-shrink: 0 !important;
    }
    
    /* Icon size in buttons */
    header a[href*="email"] i,
    header a[href*="fpn"] i {
        font-size: 0.82rem;
        margin-right: 0.28rem !important;
    }
    
    [dir="rtl"] header a[href*="email"] i,
    [dir="rtl"] header a[href*="fpn"] i {
        margin-right: 0 !important;
        margin-left: 0.28rem !important;
    }
    
    /* Language selector - MATCH BUTTON SIZE */
    header #language-selector {
        padding: 0.4rem 0.5rem !important;
        padding-right: 1.8rem!important;
        font-size: 0.78rem !important;
        min-width: 82px !important;
        flex-shrink: 0 !important;
        height: auto !important;
    }
    
    /* RTL language selector padding */
    [dir="rtl"] header #language-selector {
        padding-right: 0.5rem !important;
        padding-left: 1.8rem !important;
        background-position: left 0.5rem center !important;
    }
    
    /* Dark mode button - MATCH BUTTON HEIGHT */
    header #dark-mode-toggle {
        padding: 0.4rem !important;
        flex-shrink: 0 !important;
        width: 34px !important;
        height: 34px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    header #dark-mode-toggle i {
        font-size: 0.82rem;
    }
    
    /* Language selector relative container */
    header .flex.flex-wrap > .relative {
        flex-shrink: 0 !important;
    }
}
/* ============================================
   MOBILE VIDEO OVERLAY BUTTONS WITH GLOW
   ============================================ */

/* Floating action buttons on mobile video */
/* Action buttons inline with title */
.mobile-video-actions-inline {
    display: flex;
    gap: 6px;
    align-items: center;
}
.mobile-action-btn {
    width: 36px;
    height: 36px;
    background: rgba(26, 86, 219, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    animation: mobile-btn-glow 2s ease-in-out infinite;
}

.mobile-action-btn:hover {
    background: rgba(26, 86, 219, 1);
    transform: scale(1.1);
    animation: mobile-btn-glow-hover 1s ease-in-out infinite;
}

.mobile-action-btn:active {
    transform: scale(0.95);
}

/* Glow animation for mobile buttons */
@keyframes mobile-btn-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(26, 86, 219, 0.5),
                    0 0 10px rgba(26, 86, 219, 0.3),
                    0 2px 8px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(26, 86, 219, 0.8),
                    0 0 25px rgba(26, 86, 219, 0.5),
                    0 0 35px rgba(26, 86, 219, 0.3),
                    0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

@keyframes mobile-btn-glow-hover {
    0%, 100% {
        box-shadow: 0 0 10px rgba(26, 86, 219, 0.8),
                    0 0 20px rgba(26, 86, 219, 0.6),
                    0 0 30px rgba(26, 86, 219, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(26, 86, 219, 1),
                    0 0 35px rgba(26, 86, 219, 0.8),
                    0 0 50px rgba(26, 86, 219, 0.6);
    }
}

/* Dark mode glow */
.dark .mobile-action-btn {
    animation: mobile-btn-glow-dark 2s ease-in-out infinite;
}

.dark .mobile-action-btn:hover {
    animation: mobile-btn-glow-hover-dark 1s ease-in-out infinite;
}

@keyframes mobile-btn-glow-dark {
    0%, 100% {
        box-shadow: 0 0 5px rgba(96, 165, 250, 0.5),
                    0 0 10px rgba(96, 165, 250, 0.3),
                    0 2px 8px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 15px rgba(96, 165, 250, 0.8),
                    0 0 25px rgba(96, 165, 250, 0.5),
                    0 0 35px rgba(96, 165, 250, 0.3),
                    0 2px 8px rgba(0, 0, 0, 0.5);
    }
}

@keyframes mobile-btn-glow-hover-dark {
    0%, 100% {
        box-shadow: 0 0 10px rgba(96, 165, 250, 0.8),
                    0 0 20px rgba(96, 165, 250, 0.6),
                    0 0 30px rgba(96, 165, 250, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(96, 165, 250, 1),
                    0 0 35px rgba(96, 165, 250, 0.8),
                    0 0 50px rgba(96, 165, 250, 0.6);
    }
}

/* Hide desktop video section on mobile */
@media (max-width: 1023px) {
    .desktop-video-section {
        display: none !important;
    }
}

/* Hide mobile video section on desktop */
@media (min-width: 1024px) {
    .mobile-video-section {
        display: none !important;
    }
}

/* File Upload Styles */
.file-upload-area {
    border: 2px dashed #d1d5db;
    transition: all 0.3s;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: #1a56db;
    background-color: rgba(26, 86, 219, 0.05);
}

.file-upload-area.dragover {
    border-color: #1a56db;
    background-color: rgba(26, 86, 219, 0.1);
}

.file-preview {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
}

.required-badge {
    background-color: #ef4444;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* ============================================
   CONTACT FORM MOBILE HEADER FIX
   ============================================ */

@media (max-width: 768px) {
    /* Contact form header - single row layout */
    body:has(#contact-form) header .container > div {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
    }
    
    /* Compact title */
    body:has(#contact-form) header #page-title {
        font-size: 1.3rem !important;
        margin-top: 0.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }
    
    /* Right side controls compact */
    body:has(#contact-form) header .flex.items-center.gap-4 {
        gap: 0.35rem !important;
        flex-shrink: 0;
    }
    
    /* Compact language selector */
    body:has(#contact-form) header #language-selector {
        padding: 0.4rem 0.5rem !important;
        padding-right: 1.8rem !important;
        font-size: 0.75rem !important;
        min-width: 70px !important;
    }
    
    /* Compact dark mode button */
    body:has(#contact-form) header #dark-mode-toggle {
        padding: 0.4rem !important;
        width: 32px !important;
        height: 32px !important;
    }
}
[dir="rtl"] {
    font-family: 'Cairo', Arial, sans-serif;
}
