/* client/style.css - Modernized for Bootstrap 5 & Glassmorphism */
:root {
    /* Brand Colors */
    --primary: #0a8754;
    /* Signature Green */
    --primary-gradient: linear-gradient(135deg, #0a8754 0%, #065f3a 100%);
    --secondary: #2c3e50;
    /* Deep Navy */
    --secondary-gradient: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    --accent: #f39c12;
    /* Orange Alert */

    /* Functional Colors */
    --light: #f8f9fa;
    --dark: #1a1a1a;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);

    /* Shadows */
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(10, 135, 84, 0.2);
}

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    background-color: #f0f2f5;
    color: var(--secondary);
    direction: rtl;
    line-height: 1.7;
    overflow-x: hidden;
    padding-bottom: 80px;
    /* Ensure content isn't hidden behind nav */
}

/* --- Auth Container (Login/Register Pages) --- */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f0f2f5 0%, #e8f5e9 100%);
}

.auth-box {
    width: 100%;
    max-width: 440px;
}

/* --- Loading Splash Screen: moved to css/splash.css --- */

/* --- Typography Overrides --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 800;
    margin-bottom: 0.5rem;
}

/* --- Glassmorphism Utilities --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: 16px;
}

@media (max-width: 768px) {
    .glass-card {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    }

    .container {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

.glass-nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* --- Button Modernization --- */
.btn {
    border-radius: 12px;
    padding: 10px 24px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px rgba(10, 135, 84, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(10, 135, 84, 0.4);
    background: var(--primary);
}

.btn-outline-primary {
    color: var(--primary);
    border: 2px solid var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: var(--secondary-gradient);
    color: white;
}

/* --- Card Modernization --- */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* --- Form Elements --- */
.form-control {
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid #eee;
    background-color: #fcfcfc;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(10, 135, 84, 0.1);
    background-color: white;
}

/* --- Hero Section --- */
.hero-wrapper {
    position: relative;
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.9), rgba(10, 135, 84, 0.8)), url('https://images.unsplash.com/photo-1616400619175-5beda3a17896?auto=format&fit=crop&w=1500&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding: 120px 0 80px;
    min-height: 85vh;
    display: flex;
    align-items: center;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
}

@media (max-width: 768px) {
    .hero-wrapper {
        clip-path: none;
        padding: 80px 0 60px;
        min-height: auto;
    }
}

/* --- Feature Cards --- */
.feature-icon-box {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: rgba(10, 135, 84, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 20px;
    transition: transform 0.3s;
}

.card-hover:hover .feature-icon-box {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary);
    color: white;
}

/* --- Dashboard / App Specifics --- */
.app-header {
    background: var(--secondary-gradient);
    color: white;
    border-radius: 0 0 20px 20px;
    padding-bottom: 16px;
    margin-bottom: 0;
    box-shadow: var(--shadow-md);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    padding: 0 15px;
}

/* --- Mobile Bottom Nav: see enhanced-styles.css for unified definition --- */

/* --- Loading Skeleton Animation --- */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(to right, #eff1f3 4%, #e2e2e2 25%, #eff1f3 36%);
    background-size: 1000px 100%;
}

/* --- Google Maps Web SDK --- */
/* The map renders directly in the DOM — no transparency hacks needed */

#map,
#shopOrderMap {
    width: 100%;
    height: 100%;
}

#static-map-container,
#shop-map-overlay {
    background: #e8e8e8; /* Neutral fallback while map tiles load */
}

/* ─────────────────────────────────────────────────
   MAP FLOATING ACTION BUTTONS  (Locate / Theme / Layer)
   Premium Glassmorphism Style
───────────────────────────────────────────────── */
.map-fab-btn {
    /* Size & Shape */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    flex-shrink: 0;

    /* Appearance (Glassmorphism) */
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    outline: none;

    /* Soft but deep layered shadow */
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 8px 16px rgba(0, 0, 0, 0.1),
        0 15px 30px rgba(0, 0, 0, 0.08);

    /* Icon */
    font-size: 1.3rem; /* Slightly larger icon */
    color: #1e2a36; /* Deep dark blue/gray for premium contrast */

    /* Layout */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Interaction */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;

    /* Smooth spring transition */
    transition:
        transform  0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.25s ease,
        background 0.25s ease,
        color      0.25s ease;
}

.map-fab-btn:hover {
    transform: scale(1.1);
    background: #f5f5f5;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.14),
        0 8px 24px rgba(0, 0, 0, 0.14);
}

.map-fab-btn:active {
    transform: scale(0.9);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.12),
        0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Toggled / active state — green fill */
.map-fab-btn.is-active {
    background: linear-gradient(145deg, #0a8754, #1aad68);
    color: #ffffff;
    box-shadow:
        0 2px 6px rgba(10, 135, 84, 0.3),
        0 6px 18px rgba(10, 135, 84, 0.25);
}

.map-fab-btn.is-active:hover {
    background: linear-gradient(145deg, #089060, #1ec873);
}

/* Locate-me — pulsing glow while GPS is fetching */
.map-fab-btn.is-locating {
    pointer-events: none;
    animation: fabGlowPulse 1.4s ease-in-out infinite;
}

@keyframes fabGlowPulse {
    0%, 100% {
        box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.14),
            0 4px 12px rgba(0, 0, 0, 0.10);
    }
    50% {
        box-shadow:
            0 2px 6px rgba(10, 135, 84, 0.25),
            0 6px 22px rgba(10, 135, 84, 0.45);
    }
}


/* ─────────────────────────────────────────────────
   MAP SEARCH BAR — night-mode override
───────────────────────────────────────────────── */
#static-map-container.map-night .map-search-wrapper,
#static-map-container.map-night .map-fab-btn {
    background: #1e2a36;
    color: #e0e0e0;
}

#static-map-container.map-night #map-search-input {
    color: #e0e0e0;
}

#static-map-container.map-night #map-search-input::placeholder {
    color: #778899;
}

/* Hide Google Maps default attribution in fullscreen map to reduce clutter */
#static-map-container .gm-style-cc { display: none !important; }

/* ─────────────────────────────────────────────────
   ROUTE INFO CARD
───────────────────────────────────────────────── */
.route-stat-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 8px;
    text-align: center;
    transition: background 0.2s ease;
}

.route-stat-cell:active {
    background: rgba(10, 135, 84, 0.04);
}

/* Shimmer on the spans while loading */
#route-info-card.is-loading #route-distance,
#route-info-card.is-loading #route-duration,
#route-info-card.is-loading #route-price {
    color: transparent !important;
    background: linear-gradient(90deg, #e0e0e0 25%, #f5f5f5 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: routeShimmer 1.2s infinite linear;
    border-radius: 6px;
    min-width: 48px;
    display: inline-block;
}

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

/* ─────────────────────────────────────────────────
   GEOFENCING WARNING BANNER
───────────────────────────────────────────────── */
.map-warning-banner {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 125px); /* Below search bar */
    left: 16px;
    right: 16px;
    background: #dc3545; /* Red */
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.4);
    z-index: 999;
    pointer-events: auto;
    
    /* Animation base state */
    transform: translateY(0);
    opacity: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, visibility 0.3s ease;
}

.map-warning-banner.hidden {
    visibility: hidden;
    opacity: 0;
    transform: translateY(-20px);
}

/* Disabled Confirm Button style */
button#map-confirm-btn:disabled, 
button#map-confirm-btn.disabled {
    background: #8b8b8b !important;
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: 0.8;
}