/**
 * Abo Raaya Motors - Premium 2025 Color System
 * Inspired by: Carvana, Tesla, Modern EV Dashboards
 * 
 * Palette: "Midnight Premium"
 * - Deep charcoals for trust and sophistication
 * - Electric blue for energy and CTAs
 * - Amber gold for warmth and secondary actions
 */

:root {
    /* ===== PRIMARY PALETTE: Midnight Depths ===== */
    --midnight-900: #0A0E1A;
    /* Deepest - Page backgrounds */
    --midnight-800: #131925;
    /* Cards, elevated surfaces */
    --midnight-700: #1E2533;
    /* Hover states, secondary surfaces */
    --midnight-600: #2C3444;
    /* Borders, dividers */
    --midnight-500: #3D4657;
    /* Disabled states */

    /* ===== ACCENT: Electric Blue (Primary CTAs) ===== */
    --electric-blue: #00D4FF;
    --electric-blue-hover: #00BADF;
    --electric-blue-light: rgba(0, 212, 255, 0.1);
    --electric-blue-glow: rgba(0, 212, 255, 0.25);

    /* ===== ACCENT: Amber Gold (Secondary Actions) ===== */
    --amber-gold: #FFB020;
    --amber-gold-hover: #E69A00;
    --amber-gold-light: rgba(255, 176, 32, 0.1);

    /* ===== NEUTRAL GRAYSCALE ===== */
    --white: #FFFFFF;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    /* Muted text */
    --gray-500: #64748B;
    /* Secondary text */
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* ===== STATUS COLORS (Automotive-Specific) ===== */
    --status-excellent: #10B981;
    /* Emerald - Great deal */
    --status-good: #06B6D4;
    /* Cyan - Good price */
    --status-fair: #F59E0B;
    /* Amber - Fair price */
    --status-below: #EF4444;
    /* Red - Above market */
    --status-verified: #8B5CF6;
    /* Purple - Verified dealer */
    --status-pending: #F59E0B;
    /* Amber - Pending approval */
    --status-sold: #6B7280;
    /* Gray - Sold */

    /* ===== GLASSMORPHISM 2.0 ===== */
    --glass-bg: rgba(19, 25, 37, 0.75);
    --glass-bg-light: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-glow: var(--electric-blue-glow);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);

    /* ===== SPACING SYSTEM (8px base) ===== */
    --space-1: 0.5rem;
    /* 8px */
    --space-2: 1rem;
    /* 16px */
    --space-3: 1.5rem;
    /* 24px */
    --space-4: 2rem;
    /* 32px */
    --space-5: 3rem;
    /* 48px */
    --space-6: 4rem;
    /* 64px */
    --space-8: 6rem;
    /* 96px */

    /* ===== TYPOGRAPHY ===== */
    --font-ar: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-en: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Font Weights */
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* ===== TRANSITIONS ===== */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* ===== BORDER RADIUS ===== */
    --radius-sm: 0.375rem;
    /* 6px */
    --radius-md: 0.5rem;
    /* 8px */
    --radius-lg: 0.75rem;
    /* 12px */
    --radius-xl: 1rem;
    /* 16px */
    --radius-2xl: 1.5rem;
    /* 24px */
    --radius-full: 9999px;

    /* ===== Z-INDEX SCALE ===== */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* ===== BODY DEFAULTS ===== */
html {
    scroll-behavior: smooth;
}

body {
    background: var(--midnight-900);
    color: var(--white);
    font-family: var(--font-en);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body[lang="ar"] {
    font-family: var(--font-ar);
}

/* Selection Color */
::selection {
    background: var(--electric-blue);
    color: var(--midnight-900);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--midnight-800);
}

::-webkit-scrollbar-thumb {
    background: var(--midnight-600);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--electric-blue);
}

/* ===== PREMIUM BUTTON STYLES ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--electric-blue) 0%, #0099CC 100%);
    color: var(--white);
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-lg);
    font-weight: var(--font-semibold);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 14px rgba(0, 212, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--electric-blue);
    border: 2px solid var(--electric-blue);
    padding: 0.875rem 2rem;
    border-radius: var(--radius-lg);
    font-weight: var(--font-semibold);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-secondary:hover {
    background: var(--electric-blue-light);
    transform: translateY(-2px);
}

.btn-gold {
    background: linear-gradient(135deg, var(--amber-gold) 0%, #E69A00 100%);
    color: var(--midnight-900);
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-lg);
    font-weight: var(--font-bold);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 14px rgba(255, 176, 32, 0.3);
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 176, 32, 0.4);
}

/* ===== GLASS CARDS (Updated) ===== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-base);
}

.glass-card:hover {
    border-color: var(--electric-blue);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.2);
}

.glass-card-light {
    background: var(--glass-bg-light);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

/* ===== FORM INPUTS (Floating Labels) ===== */
.input-group {
    position: relative;
    margin-bottom: var(--space-3);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 1rem 1rem 0.5rem;
    background: var(--midnight-700);
    border: 2px solid var(--midnight-600);
    border-radius: var(--radius-md);
    color: var(--white);
    font-size: 1rem;
    transition: all var(--transition-base);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--electric-blue);
    background: var(--midnight-800);
    box-shadow: 0 0 0 4px var(--electric-blue-light);
}

.input-group label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 1rem;
    pointer-events: none;
    transition: all var(--transition-fast);
}

.input-group input:focus+label,
.input-group input:not(:placeholder-shown)+label {
    top: 0.5rem;
    font-size: 0.75rem;
    color: var(--electric-blue);
}

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: var(--font-medium);
    white-space: nowrap;
}

.badge-excellent {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-excellent);
    border: 1px solid var(--status-excellent);
}

.badge-good {
    background: rgba(6, 182, 212, 0.15);
    color: var(--status-good);
    border: 1px solid var(--status-good);
}

.badge-fair {
    background: rgba(245, 158, 11, 0.15);
    color: var(--status-fair);
    border: 1px solid var(--status-fair);
}

.badge-verified {
    background: rgba(139, 92, 246, 0.15);
    color: var(--status-verified);
    border: 1px solid var(--status-verified);
}

/* ===== NAVBAR (Updated) ===== */
.navbar {
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--midnight-600);
    padding: 1rem 0;
    transition: all var(--transition-base);
}

.navbar.scrolled {
    background: rgba(10, 14, 26, 0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.nav-link {
    color: var(--white) !important;
    /* Changed from gray-300 for better contrast */
    font-weight: var(--font-medium);
    transition: color var(--transition-fast);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
}

.nav-link:hover {
    color: var(--electric-blue) !important;
    background: var(--electric-blue-light);
}

/* Dropdown Menu */
.dropdown-menu {
    background: var(--midnight-800);
    border: 1px solid var(--midnight-600);
    border-radius: var(--radius-md);
    padding: 0.5rem;
}

.dropdown-item {
    color: var(--white) !important;
    /* Changed for better contrast */
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--electric-blue-light);
    color: var(--electric-blue) !important;
}

/* ===== LISTING CARDS (Enhanced 2025) ===== */
.listing-card {
    background: var(--midnight-800);
    border: 1px solid var(--midnight-600);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-slow);
    position: relative;
}

.listing-card:hover {
    transform: translateY(-8px);
    border-color: var(--electric-blue);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px var(--electric-blue),
        0 0 30px rgba(0, 212, 255, 0.2);
}

/* Image Container with Zoom Effect */
.listing-card-image {
    position: relative;
    overflow: hidden;
    height: 280px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.listing-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, filter 0.3s ease;
}

.listing-card:hover .listing-card-image img {
    transform: scale(1.08);
    filter: brightness(1.1);
}

/* Gradient Overlay for Text Readability */
.listing-card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.9) 0%, transparent 100%);
    pointer-events: none;
}

/* Price Badge on Image */
.listing-card-price {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: linear-gradient(135deg, var(--electric-blue) 0%, #0099CC 100%);
    color: var(--white);
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    font-size: 1.25rem;
    font-weight: var(--font-bold);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

/* Featured Ribbon */
.listing-card-featured {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--amber-gold) 0%, #E69A00 100%);
    color: var(--midnight-900);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: var(--font-bold);
    text-transform: uppercase;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Card Body */
.listing-card-body {
    padding: 1.25rem;
}

.listing-title {
    font-size: 1.1rem;
    font-weight: var(--font-semibold);
    color: var(--white);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.listing-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.listing-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--gray-400);
    font-size: 0.875rem;
}

.listing-meta-item i {
    color: var(--electric-blue);
    font-size: 0.9rem;
}

/* Old price style kept for compatibility */
.listing-price {
    color: var(--electric-blue);
    font-size: 1.75rem;
    font-weight: var(--font-bold);
    line-height: 1;
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */
.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: var(--font-extrabold);
    line-height: 1.1;
    background: linear-gradient(135deg, var(--white) 0%, var(--electric-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gold {
    color: var(--amber-gold) !important;
}

.text-blue {
    color: var(--electric-blue) !important;
}

/* ===== UTILITY CLASSES ===== */
.bg-midnight {
    background: var(--midnight-900);
}

.bg-midnight-800 {
    background: var(--midnight-800);
}

.bg-midnight-700 {
    background: var(--midnight-700);
}

.text-white {
    color: var(--white);
}

.text-gray-200 {
    color: var(--gray-200);
}

.text-gray-400 {
    color: var(--gray-400);
}

/* ===== HERO SECTION ENHANCEMENTS ===== */
.hero-title {
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.7),
        0 2px 8px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

/* ===== SKELETON LOADING ANIMATION ===== */
.skeleton {
    background: linear-gradient(90deg,
            var(--midnight-700) 25%,
            var(--midnight-600) 50%,
            var(--midnight-700) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite ease-in-out;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ===== CAR IMAGE PLACEHOLDER ===== */
.car-placeholder-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--midnight-700) 0%, var(--midnight-800) 100%);
    gap: 0.5rem;
}

.car-placeholder-container i {
    font-size: 4rem;
    color: var(--electric-blue);
    opacity: 0.25;
}

.car-placeholder-container span {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== COMPARE BAR ANIMATION ===== */
#compare-bar {
    transform: translateY(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#compare-bar.visible {
    transform: translateY(0);
}

/* ===== MICRO-INTERACTIONS ===== */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn-primary:active::after {
    width: 300px;
    height: 300px;
}

/* CTA Pulse Animation */
.cta-pulse {
    animation: ctaPulse 2s ease-in-out infinite;
}

@keyframes ctaPulse {

    0%,
    100% {
        box-shadow: 0 4px 14px rgba(0, 212, 255, 0.3);
    }

    50% {
        box-shadow: 0 4px 24px rgba(0, 212, 255, 0.5),
            0 0 40px rgba(0, 212, 255, 0.2);
    }
}

/* ===== IMPROVED FOCUS STATES (Accessibility) ===== */
.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--electric-blue);
    box-shadow: 0 0 0 3px var(--electric-blue-light);
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--electric-blue);
    outline-offset: 2px;
}

/* ===== ANIMATION UTILITIES ===== */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}