/* ═══════════════════════════════════════════════════════════════
   AUTO CAR — السيستم المتكامل
   Custom CSS — Glassmorphism, Animations, Mobile-First
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    overscroll-behavior-y: contain;
}

/* ── Glassmorphism Cards (Light Purple Theme) ────────────────── */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(124, 58, 237, 0.08);
    box-shadow: 0 10px 30px -10px rgba(124, 58, 237, 0.06), 0 1px 3px rgba(0, 0, 0, 0.02);
}

.glass-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(124, 58, 237, 0.08);
    box-shadow: 0 4px 20px -5px rgba(124, 58, 237, 0.05);
}

.glass-nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(124, 58, 237, 0.08);
    box-shadow: 0 -4px 20px -5px rgba(124, 58, 237, 0.05);
}

/* ── Stat Cards ──────────────────────────────────────────────── */
.stat-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(124, 58, 237, 0.06);
    border-radius: 1rem;
    padding: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px -8px rgba(124, 58, 237, 0.05);
    animation: slideUp 0.4s ease-out both;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 107, 26, 0.25); /* Orange hover border */
    box-shadow: 0 12px 28px -6px rgba(255, 107, 26, 0.08), 0 4px 12px rgba(124, 58, 237, 0.03);
    transform: translateY(-3px);
}

.stat-card:active {
    transform: scale(0.98);
}

/* ── Feature Cards ───────────────────────────────────────────── */
.feature-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(124, 58, 237, 0.06);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 8px 24px -8px rgba(124, 58, 237, 0.05);
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 107, 26, 0.25); /* Orange hover border */
    box-shadow: 0 12px 28px -6px rgba(255, 107, 26, 0.08);
    transform: translateX(-4px); /* RTL slide-in */
}

.feature-card:active {
    transform: scale(0.98);
}

/* ── Bottom Navigation ───────────────────────────────────────── */
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
    color: rgba(124, 58, 237, 0.5); /* Purple tint with opacity */
    font-size: 9px;
    font-weight: 600;
    min-width: 56px;
    text-decoration: none;
}

.bottom-nav-item:hover,
.bottom-nav-item:active {
    color: #7c3aed; /* Stronger purple */
    background: rgba(124, 58, 237, 0.05);
}

.bottom-nav-item.active {
    color: #FF6B1A; /* Vibrant orange active state */
    background: rgba(255, 107, 26, 0.08);
    box-shadow: 0 4px 12px -3px rgba(255, 107, 26, 0.2);
}

/* ── Safe Area (iOS notch) ───────────────────────────────────── */
.safe-area-bottom {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 4px rgba(255, 107, 26, 0.2);
    }
    50% {
        box-shadow: 0 0 16px rgba(255, 107, 26, 0.4);
    }
}

/* ── Loading Skeleton ────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 25%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.03) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

/* ── Form Inputs (Login) ─────────────────────────────────────── */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 40px #1a1f2e inset !important;
    -webkit-text-fill-color: #e2e8f0 !important;
    caret-color: #e2e8f0;
    transition: background-color 5000s ease-in-out 0s;
}

/* ── Prevent zoom on inputs (iOS) ─────────────────────────────  */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* ── Counter Animation ───────────────────────────────────────── */
.counter {
    transition: all 0.3s ease;
}

/* ── RTL Adjustments ─────────────────────────────────────────── */
[dir="rtl"] .feature-card:hover {
    transform: translateX(-4px);
}

/* ── Focus Visible (Accessibility) ───────────────────────────── */
:focus-visible {
    outline: 2px solid #FF6B1A;
    outline-offset: 2px;
    border-radius: 8px;
}

/* ── Responsive Typography ───────────────────────────────────── */
@media (min-width: 390px) {
    .stat-card p:first-of-type {
        font-size: 1.75rem;
    }
}

@media (max-width: 350px) {
    .stat-card {
        padding: 0.75rem;
    }
    .stat-card p:first-of-type {
        font-size: 1.25rem;
    }
}

/* ── Light Mode Text & Form Overrides ───────────────────────── */

/* Force dark text for readability inside light cards, headers, and footer */
.glass-card .text-white, 
.stat-card .text-white, 
.feature-card .text-white,
.glass-header .text-white,
.glass-nav .text-white,
.glass-card h3.text-white,
.glass-card h4.text-white,
.glass-card p.text-white {
    color: #1e1b4b !important; /* Deep indigo */
}

.glass-card .text-slate-300, 
.stat-card .text-slate-300, 
.feature-card .text-slate-300,
.glass-header .text-slate-300,
.glass-nav .text-slate-300 {
    color: #581c87 !important; /* Rich purple */
}

.glass-card .text-slate-400,
.stat-card .text-slate-400,
.feature-card .text-slate-400,
.glass-header .text-slate-400 {
    color: #6b21a8 !important; /* Purple tone for subtitles/labels */
}

.glass-card .text-slate-500, 
.stat-card .text-slate-500, 
.feature-card .text-slate-500,
.glass-header .text-slate-500,
.glass-nav .text-slate-500 {
    color: #6b7280 !important; /* Gray-slate for minor details */
}

/* Section titles on the dashboard & other pages */
main h2.text-slate-300, 
main h2 {
    color: #4c1d95 !important; /* Deep violet-purple */
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px;
}

/* Make Form Inputs/Selects inside glass-cards look beautiful and light */
.glass-card input, 
.glass-card select, 
.glass-card textarea,
#add-car-modal input,
#add-car-modal select,
#add-car-modal textarea {
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px solid rgba(124, 58, 237, 0.12) !important;
    color: #1e1b4b !important;
}

.glass-card input:focus, 
.glass-card select:focus, 
.glass-card textarea:focus,
#add-car-modal input:focus,
#add-car-modal select:focus,
#add-car-modal textarea:focus {
    background: #ffffff !important;
    border-color: #FF6B1A !important; /* Highlight with Orange focus */
    box-shadow: 0 0 0 2px rgba(255, 107, 26, 0.1) !important;
    outline: none !important;
}

.glass-card input::placeholder,
#add-car-modal input::placeholder {
    color: #94a3b8 !important;
}

/* Adjust card dividers and borders */
.border-white\/\[0\.04\], 
.border-white\/\[0\.05\], 
.border-white\/\[0\.06\], 
.border-white\/\[0\.08\],
.border-t.border-white\/\[0\.04\],
.border-t.border-white\/\[0\.06\] {
    border-color: rgba(124, 58, 237, 0.08) !important;
}

.bg-white\/\[0\.04\], 
.bg-white\/\[0\.05\], 
.bg-white\/\[0\.06\] {
    background-color: rgba(124, 58, 237, 0.04) !important;
}

/* Ensure modal overlays (backdrop) look amazing */
.fixed.inset-0.bg-black\/60,
.fixed.inset-0.bg-black\/90 {
    background-color: rgba(30, 27, 75, 0.5) !important; /* Soft deep-indigo translucent overlay */
    backdrop-filter: blur(8px) !important;
}

/* Quick stat items */
.bg-surface-dark\/40 {
    background-color: rgba(124, 58, 237, 0.04) !important;
    border: 1px solid rgba(124, 58, 237, 0.06) !important;
}

/* ── Dark Glassmorphism Card (Explicitly for Login Screen Reversion) ── */
.dark-glass-card {
    background: rgba(26, 31, 46, 0.75) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* Ensure original light colors inside dark-glass-card are preserved */
.dark-glass-card .text-slate-100 {
    color: #f1f5f9 !important;
}
.dark-glass-card .text-slate-400 {
    color: #94a3b8 !important;
}
.dark-glass-card .text-slate-500 {
    color: #64748b !important;
}
.dark-glass-card .text-slate-600 {
    color: #475569 !important;
}
.dark-glass-card .text-slate-700 {
    color: #cbd5e1 !important; /* Soften footer text to light-slate for original dark theme readability */
}
.dark-glass-card .text-slate-700\/70 {
    color: rgba(203, 213, 225, 0.7) !important;
}

/* Explicit style overrides for inputs inside dark-glass-card to ensure original styling */
.dark-glass-card input {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

.dark-glass-card input:focus {
    background: rgba(255, 107, 26, 0.04) !important;
    border-color: #FF6B1A !important;
    box-shadow: 0 0 0 2px rgba(255, 107, 26, 0.15) !important;
    outline: none !important;
}

.dark-glass-card input::placeholder {
    color: #475569 !important;
}

/* ── Global Contrast & Readability Overrides for Light Theme ────────────────── */
/* These rules target internal screens (outside the login dark card) to guarantee maximum contrast */

/* Ensure all inputs, selects, and textareas on internal screens are highly readable */
input:not(.dark-glass-card *),
select:not(.dark-glass-card *),
textarea:not(.dark-glass-card *) {
    background-color: #ffffff !important;
    border: 1px solid rgba(124, 58, 237, 0.16) !important;
    color: #1e1b4b !important;
}

input:not(.dark-glass-card *):focus,
select:not(.dark-glass-card *):focus,
textarea:not(.dark-glass-card *):focus {
    background-color: #ffffff !important;
    border-color: #FF6B1A !important;
    box-shadow: 0 0 0 2px rgba(255, 107, 26, 0.12) !important;
    color: #1e1b4b !important;
}

input:not(.dark-glass-card *)::placeholder,
textarea:not(.dark-glass-card *)::placeholder {
    color: #8b5cf6 !important; /* Visible brand purple placeholder */
    opacity: 0.65;
}

select:not(.dark-glass-card *) option {
    background-color: #ffffff !important;
    color: #1e1b4b !important;
}

/* Fix light grey and brand utility texts that have low contrast on light backgrounds */
.text-slate-100:not(.dark-glass-card *),
.text-slate-200:not(.dark-glass-card *),
.text-slate-300:not(.dark-glass-card *),
.text-brand-100:not(.dark-glass-card *) {
    color: #1e1b4b !important; /* Rich deep indigo */
}

.text-slate-400:not(.dark-glass-card *),
.text-brand-300:not(.dark-glass-card *) {
    color: #6d28d9 !important; /* Vibrant purple instead of pastel purple */
}

.text-slate-500:not(.dark-glass-card *) {
    color: #4b5563 !important; /* Dark slate gray */
}

/* Keep white text on solid buttons/badges and inside active tags but override plain white texts */
.text-white:not(.dark-glass-card *):not(button):not(button *):not(a):not(a *):not(.bg-brand-500 *):not(.bg-accent-orange *):not(.bg-green-500 *):not(.bg-red-500 *):not(.bg-purple-500 *):not(.bg-blue-500 *):not(.bg-gradient-to-bl *):not(.bg-gradient-to-l *) {
    color: #1e1b4b !important; /* Force high contrast deep indigo */
}

/* Modals enhancements */
#add-car-modal .bg-surface-card,
#add-renter-modal .bg-surface-card {
    background-color: #ffffff !important;
    border: 1px solid rgba(124, 58, 237, 0.16) !important;
}

#add-car-modal .bg-surface-dark\/50,
#add-renter-modal .bg-surface-dark\/50 {
    background-color: rgba(124, 58, 237, 0.04) !important;
    border-bottom-color: rgba(124, 58, 237, 0.08) !important;
}

#add-car-modal h3.text-white,
#add-renter-modal h3.text-white {
    color: #1e1b4b !important;
}

/* Rentals and Navigation Active/Inactive tab adjustments */
.border-b.border-white\/\[0\.06\] a {
    color: #6b7280 !important;
}
.border-b.border-white\/\[0\.06\] a.text-brand-300 {
    color: #7c3aed !important;
    border-bottom-color: #FF6B1A !important;
}

/* Fix quick stats badges text colors */
.bg-green-500\/10 span.text-slate-400,
.bg-accent-orange\/10 span.text-slate-400,
.bg-red-500\/10 span.text-slate-400 {
    color: #4b5563 !important;
    font-weight: 600;
}

/* ── Premium Fluid Border & Hover Animations for Cards ────────────────── */
.glass-card {
    border: 1.5px solid rgba(124, 58, 237, 0.18) !important;
    box-shadow: 0 10px 30px -10px rgba(124, 58, 237, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important; /* Premium fluid timing function */
}

.glass-card:hover {
    transform: translateY(-5px) scale(1.01) !important;
    border-color: rgba(124, 58, 237, 0.4) !important;
    box-shadow: 0 20px 40px -15px rgba(124, 58, 237, 0.18), 
                0 0 20px rgba(124, 58, 237, 0.08), 
                0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

/* Staggered card entrance animation keyframes */
@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Highly interactive inner detail slots */
.glass-card .grid > div {
    background: rgba(124, 58, 237, 0.03) !important;
    border: 1px solid rgba(124, 58, 237, 0.06) !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.glass-card:hover .grid > div {
    background: rgba(124, 58, 237, 0.06) !important;
    border-color: rgba(124, 58, 237, 0.15) !important;
    transform: scale(1.02) !important;
}

/* Header button and action anchor animations */
header button, header a, .fixed button, .fixed a {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

header button:hover, header a:hover, .fixed button:hover, .fixed a:hover {
    transform: translateY(-2px) scale(1.05);
}

header button:active, header a:active, .fixed button:active, .fixed a:active {
    transform: translateY(0) scale(0.95);
}

/* Status badge dynamic scaling on card hover */
.glass-card .absolute.top-3.right-3 {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.glass-card:hover .absolute.top-3.right-3 {
    transform: scale(1.08) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

