/* ========================================
   تحسينات التصميم الاحترافي - وصل-لي
   ======================================== */

:root {
    --primary-color: #0a8754;
    --primary-dark: #086b42;
    --primary-light: #e8f5f0;
    --secondary-color: #dc3545;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-dark: #212529;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    padding-bottom: 100px;
    color: var(--text-dark);
}

/* ========================================
   Header المحسّن
   ======================================== */
.app-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 10px 20px;
    padding-bottom: 14px;
    box-shadow: var(--shadow-md);
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0 0 18px 18px;
}

.app-header .btn-light {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    transition: var(--transition);
}

.app-header .btn-light:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.app-header h6 {
    color: white;
    font-weight: 700;
    margin: 0;
}

.app-header small {
    color: rgba(255, 255, 255, 0.85);
}

.app-header .bi-bell {
    color: white;
    transition: var(--transition);
}

.app-header .bi-bell:hover {
    transform: scale(1.1);
}

/* ========================================
   Cards المحسّنة
   ======================================== */
.section-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.section-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.section-title i {
    font-size: 1.2rem;
}

.section-title.text-success i {
    color: var(--primary-color);
}

.section-title.text-danger i {
    color: var(--secondary-color);
}

/* ========================================
   Form Controls المحسّنة
   ======================================== */
.form-control {
    background-color: #f8f9fa;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 0.95rem;
    transition: var(--transition);
    font-weight: 500;
}

.form-control:focus {
    background-color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(10, 135, 84, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: #adb5bd;
    font-weight: 400;
}

/* ========================================
   Map Button المحسّن
   ======================================== */
.map-btn {
    background: linear-gradient(135deg, var(--primary-light) 0%, #d4f1e8 100%);
    color: var(--primary-dark);
    border: 2px dashed var(--primary-color);
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.map-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.map-btn:hover::before {
    left: 100%;
}

.map-btn:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.map-btn:active {
    transform: translateY(0) scale(0.98);
}

/* نفس الشيء للزر الأحمر */
.map-btn[style*="color: #dc3545"] {
    background: linear-gradient(135deg, #fdf2f2 0%, #fce4e4 100%);
    color: #b02a37;
    border-color: var(--secondary-color);
}

.map-btn[style*="color: #dc3545"]:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #b02a37 100%);
    color: white;
    border-color: #b02a37;
}

/* ========================================
   Map Select Buttons - أزرار اختيار الموقع البارزة
   ======================================== */
.map-select-btn {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.map-select-btn i:first-child {
    font-size: 1.2rem;
}

.map-select-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.map-select-btn:hover::before {
    left: 100%;
}

/* Pickup (Green) */
.map-select-btn-pickup {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: var(--primary-dark);
    border-color: var(--primary-color);
}

.map-select-btn-pickup:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(10, 135, 84, 0.3);
}

.map-select-btn-pickup:active {
    transform: translateY(0) scale(0.98);
}

/* Dropoff (Red) */
.map-select-btn-dropoff {
    background: linear-gradient(135deg, #fce4e4 0%, #f8d7da 100%);
    color: #b02a37;
    border-color: var(--secondary-color);
}

.map-select-btn-dropoff:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #b02a37 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.map-select-btn-dropoff:active {
    transform: translateY(0) scale(0.98);
}

/* ========================================
   Pricing Section المحسّنة
   ======================================== */
.price-input {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
    border: 3px solid var(--primary-color) !important;
    color: var(--primary-dark) !important;
    font-weight: 800 !important;
    font-size: 1.4rem !important;
    text-align: center !important;
    padding: 16px !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 12px rgba(10, 135, 84, 0.15) !important;
}

.price-input:focus {
    box-shadow: 0 0 0 4px rgba(10, 135, 84, 0.2) !important;
    transform: scale(1.02);
}

.form-select {
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-weight: 600;
    background-color: white;
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 4px rgba(10, 135, 84, 0.1);
}

/* ========================================
   Submit Button المحسّن
   ======================================== */
.btn-submit {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 800;
    padding: 18px;
    border-radius: 50px;
    width: 100%;
    border: none;
    font-size: 1.15rem;
    box-shadow: 0 6px 20px rgba(10, 135, 84, 0.3);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    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.6s, height 0.6s;
}

.btn-submit:hover::before {
    width: 300px;
    height: 300px;
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(10, 135, 84, 0.4);
}

.btn-submit:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-submit:disabled {
    background: linear-gradient(135deg, #adb5bd 0%, #6c757d 100%);
    box-shadow: none;
    cursor: not-allowed;
}

/* --- (Old nav definition removed — unified below in line ~975) --- */

/* ========================================
   Offcanvas Sidebar المحسّن
   ======================================== */
.offcanvas-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-bottom: 3px solid var(--primary-dark);
}

.list-group-item {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    transition: var(--transition);
    font-weight: 500;
}

.list-group-item:hover {
    background: var(--primary-light);
    padding-right: 25px;
}

.list-group-item i {
    font-size: 1.2rem;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-card {
    animation: fadeIn 0.5s ease-out;
}

.section-card:nth-child(1) {
    animation-delay: 0.1s;
}

.section-card:nth-child(2) {
    animation-delay: 0.2s;
}

.section-card:nth-child(3) {
    animation-delay: 0.3s;
}

.section-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* ========================================
   Responsive Improvements
   ======================================== */
@media (max-width: 576px) {
    .section-card {
        padding: 20px 16px;
    }

    .section-title {
        font-size: 0.95rem;
    }

    .btn-submit {
        font-size: 1.05rem;
        padding: 16px;
    }
}

/* ========================================
   Loading Spinner
   ======================================== */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 24px;
    height: 24px;
    border-width: 4px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin-left: -9px;
    margin-top: -9px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   Skeleton Loaders
   ======================================== */
.skeleton {
    background: linear-gradient(90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 16px;
}

/* ========================================
   New Map & Route Styles (Timeline View)
   ======================================== */

/* Map Card */
.map-card-container {
    height: 35vh;
    min-height: 250px;
    background: #e9ecef;
}

.map-view {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-control-btn {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: none;
    border-radius: 50%;
    color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.map-control-btn:active {
    transform: scale(0.9);
    background: #f8f9fa;
}

.center-marker-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -100%);
    z-index: 500;
    pointer-events: none;
    margin-top: -5px;
    /* Offset for the pin tip */
    animation: pinBounce 0.4s ease-out;
}

@keyframes pinBounce {
    0% {
        transform: translate(-50%, -150%);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -100%);
        opacity: 1;
    }
}

.center-marker-overlay svg {
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
}

/* Route Timeline Card */
.route-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
}

.route-container {
    display: flex;
    gap: 15px;
}

.route-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px;
    width: 20px;
}

.timeline-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #e0e0e0;
    z-index: 2;
}

.pickup-dot {
    background: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.dropoff-dot {
    background: var(--secondary-color);
    box-shadow: 0 0 0 2px var(--secondary-color);
}

/* Location Picker Modal Improvements */
#locationPickerModal .modal-content {
    border-radius: var(--radius-lg);
    border: none;
    overflow: hidden;
}

#locationPickerModal .modal-header {
    background: var(--primary-color);
    color: white;
    border-bottom: none;
    padding: 15px 20px;
}

#locationPickerModal .btn-close {
    filter: brightness(0) invert(1);
}

#locationPickerModal .modal-footer {
    border-top: none;
    padding: 15px;
    background: white;
}

#locationPickerModal .btn-confirm-loc {
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-md);
    padding: 12px;
    font-weight: 700;
    width: 100%;
    transition: var(--transition);
}

#locationPickerModal .btn-confirm-loc:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.timeline-line {
    flex-grow: 1;
    width: 2px;
    background: repeating-linear-gradient(to bottom, #ccc 0, #ccc 4px, transparent 4px, transparent 8px);
    margin: 4px 0;
}

.input-wrapper {
    position: relative;
    margin-bottom: 5px;
    cursor: pointer;
}

.location-input {
    padding-right: 45px !important;
    font-weight: 700 !important;
    background: #f8f9fa !important;
    border: 1px solid #f1f3f5 !important;
    height: 50px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.location-input:focus {
    background: #fff !important;
    border-color: var(--primary-color) !important;
}

.input-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    font-size: 1.2rem;
    z-index: 10;
}

/* ========================================
   Leaflet Layer Control Styling (Premium Switcher)
   ======================================== */
.leaflet-control-layers {
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
    margin-left: 15px !important;
    margin-top: 15px !important;
}

.leaflet-control-layers-toggle {
    width: 44px !important;
    height: 44px !important;
    background-size: 26px 26px !important;
    border-radius: 12px !important;
}

.leaflet-control-layers-expanded {
    padding: 12px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 16px !important;
}

.leaflet-control-layers-list {
    font-family: 'Cairo', sans-serif !important;
    font-size: 0.9rem !important;
}

.leaflet-control-layers-base label {
    margin-bottom: 8px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.leaflet-control-layers-base input {
    width: 18px !important;
    height: 18px !important;
    accent-color: var(--primary-color) !important;
}

/* Responsive adjustments */
@media (max-width: 380px) {
    .map-card-container {
        height: 30vh;
    }
}

/* ========================================
   Glass Card - Premium Look
   ======================================== */
.glass-card {
    background: var(--card-bg, #ffffff);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
    border: 1px solid var(--border-color, #e9ecef);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0, 0, 0, 0.12));
    transform: translateY(-2px);
}

.card-hover:active {
    transform: translateY(0) scale(0.995);
}

/* ========================================
   Enhanced Bottom Nav Active Indicator
   ======================================== */
.nav-item-link.active {
    position: relative;
}

.nav-item-link.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: 0 2px 6px rgba(10, 135, 84, 0.3);
}

/* ========================================
   Auth Page Improvements
   ======================================== */
.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;
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Order Cards - Premium Styling
   ======================================== */
.glass-card .card-header {
    background: transparent;
    border-bottom: none;
}

.glass-card .badge {
    font-size: 0.8rem;
    letter-spacing: 0.3px;
}

/* Price badge in order cards */
.glass-card .bg-light {
    border-radius: 12px !important;
}

/* ========================================
   Offcanvas Side Menu - Enhanced
   ======================================== */
.offcanvas {
    border-radius: 0 20px 20px 0;
    border: none !important;
}

.offcanvas-body .list-group-item {
    border-left: none;
    border-right: none;
    padding: 14px 20px;
    transition: all 0.2s ease;
}

.offcanvas-body .list-group-item:hover {
    padding-right: 24px;
    background: rgba(10, 135, 84, 0.05);
}

.offcanvas-body .list-group-item i {
    width: 24px;
    text-align: center;
}

/* ========================================
   Empty States - Professional
   ======================================== */
#guest-view i,
.text-center .bi-box-seam,
.text-center .bi-bell-slash {
    opacity: 0.4;
}

#guest-view .btn {
    font-weight: 600;
    padding: 10px 24px;
}

/* ========================================
   Form Select Dropdown - Polish
   ======================================== */
.form-select option {
    padding: 10px;
    font-weight: 500;
}

/* ========================================
   Badge Styles Enhancement
   ======================================== */
.badge.rounded-pill {
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* ========================================
   Mobile Navigation Bar - Unified Definition
   ======================================== */
body,
.main-content {
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
}

.mobile-nav-glass {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 9999 !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    padding: 10px 8px !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-radius: 0 !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important;
    transform: none !important;
    overflow: visible !important;
    min-height: 60px !important;
    height: auto !important;
    box-sizing: border-box !important;
}

.nav-item-link {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    color: #8e9196 !important;
    text-decoration: none !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    flex: 1 !important;
    min-width: 0 !important;
    padding: 8px 6px !important;
    border-radius: 14px !important;
    position: relative !important;
    background: transparent !important;
    box-shadow: none !important;
    gap: 3px !important;
}

.nav-item-link i {
    display: block !important;
    font-size: 1.4rem !important;
    line-height: 1 !important;
    margin-bottom: 2px !important;
    transition: transform 0.25s ease !important;
}

.nav-item-link span {
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    opacity: 0.9 !important;
    display: block !important;
}

.nav-item-link:hover {
    color: var(--primary-color) !important;
    background: transparent !important;
}

.nav-item-link.active {
    color: var(--primary-color) !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

.nav-item-link.active i {
    transform: scale(1.05) !important;
}

.nav-item-link.active span {
    opacity: 1 !important;
    font-weight: 700 !important;
}

/* Adjustments for items without labels (Captain pages) */
.nav-item-link:not(:has(span)) i {
    margin-bottom: 0;
}

/* Dark Mode Support */
body.dark-mode .mobile-nav-glass {
    background: rgba(26, 32, 44, 0.9);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

body.dark-mode .nav-item-link {
    color: #718096;
}

body.dark-mode .nav-item-link.active {
    color: #fff;
    background: transparent;
    box-shadow: none;
}

/* ========================================
   زر "تحديد موقعي" داخل مودال الخريطة
   ======================================== */
.modal-locate-btn {
    position: absolute;
    bottom: 20px;
    left: 16px;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-locate-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(10, 135, 84, 0.35);
}

.modal-locate-btn:active {
    transform: scale(0.95);
}