@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.15);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.15);
    
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.15);
    
    --warning: #f59e0b;
    
    --border: #334155;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.brand svg {
    color: var(--primary);
    width: 28px;
    height: 28px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap; /* Fix: prevent word wrapping inside menu links */
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background-color: var(--bg-surface);
}

.nav-links a.active {
    border-bottom: 2px solid var(--primary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background-color: transparent;
}

main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* Cards & Containers */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.card-header {
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Grids */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 0 15px var(--primary-glow);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--text-muted);
}

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

.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 0 15px var(--success-glow);
}

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

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 0 15px var(--danger-glow);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background-color: rgba(30, 41, 59, 0.5);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(30, 41, 59, 0.3);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-outline {
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-primary {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #a7f3d0;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fecaca;
}

/* Progress bar */
.progress-container {
    width: 100%;
    background-color: var(--bg-base);
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.1s ease;
}

/* Tracking Page & Maps UI */
.deliveries-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 72px); /* Full height minus header */
    position: relative;
    overflow: hidden;
}

.deliveries-map {
    flex: 1;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-control-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    width: 320px;
    box-shadow: var(--shadow-lg);
}

.map-control-overlay h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.map-control-overlay h3 svg {
    color: var(--primary);
}

.map-control-row {
    margin-bottom: 1rem;
}

.map-control-row label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.timeline-control-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    width: calc(100% - 60px);
    max-width: 800px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-title {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-date-display {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-glow);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.timeline-slider-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.timeline-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--text-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    transition: transform 0.1s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.driver-detail-popup {
    min-width: 250px;
    padding: 0.25rem;
    color: var(--text-primary);
}

.driver-detail-popup h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.driver-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.driver-stat-box {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    text-align: center;
}

.driver-stat-box .num {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.driver-stat-box .lbl {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.driver-stat-box.delivered .num { color: var(--success); }
.driver-stat-box.failed .num { color: var(--danger); }
.driver-stat-box.pending .num { color: var(--text-muted); }

.driver-speed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.25rem;
}

/* Delivery Report Dashboard CSS */
.report-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.report-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.report-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.report-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.report-card.delivered::before { background: var(--success); }
.report-card.failed::before { background: var(--danger); }
.report-card.pending::before { background: var(--text-muted); }

.report-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-glow);
    color: var(--primary);
}

.report-card.delivered .report-card-icon {
    background: var(--success-glow);
    color: var(--success);
}

.report-card.failed .report-card-icon {
    background: var(--danger-glow);
    color: var(--danger);
}

.report-card.pending .report-card-icon {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-secondary);
}

.report-card-info h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.report-card-info .value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.report-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.chart-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.chart-container {
    height: 320px;
    position: relative;
}

.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    overflow-x: auto;
}

.table-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.report-table th {
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.report-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.report-table tr:last-child td {
    border-bottom: none;
}

.report-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.progress-bar-inline {
    width: 80px;
    background: rgba(15, 23, 42, 0.5);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
    border: 1px solid var(--border);
}

.progress-bar-inline-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
}

/* Glassmorphic Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Glassmorphic Card */
.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-content {
    width: 90%;
    max-width: 440px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

/* Modal Header Components */
.modal-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 1.25rem;
}

.driver-avatar-wrapper {
    position: relative;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05);
}

.region-badge-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #1e293b;
    background-color: var(--primary);
    transition: background-color 0.3s ease;
}

.driver-profile-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
}

.driver-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
    line-height: 1.2;
}

.driver-subtitle-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-region {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
}

.region-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Modal Body */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.stat-icon-bg {
    font-size: 1.2rem;
    margin-bottom: 0.35rem;
    opacity: 0.85;
}

.stat-details {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-num {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 500;
    margin-top: 0.15rem;
}

.stat-card.stat-delivered .stat-num { color: var(--success); }
.stat-card.stat-failed .stat-num { color: var(--danger); }
.stat-card.stat-pending .stat-num { color: var(--text-secondary); }

/* Speed Box Meter styling */
.speed-box-wrapper {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.75rem;
    text-align: center;
}

.speed-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.speed-value-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.speed-num {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--warning);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.speed-unit {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.speed-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    overflow: hidden;
}

.speed-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--warning) 0%, #f97316 100%);
    border-radius: 9999px;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.25rem;
}

/* Custom Marker Styles */
.parcel-pin {
    transform-origin: bottom center;
}

.parcel-pin:hover {
    transform: scale(1.12);
}

.driver-ping-container {
    transform-origin: bottom center;
    position: relative;
    width: 34px;
    height: 42px;
}

.driver-ping-container:hover {
    transform: scale(1.08);
}

/* Pulsing effect for live tracker driver */
.driver-pulse {
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: transparent;
    opacity: 0;
    animation: markerPulse 2.2s infinite ease-out;
    pointer-events: none;
    top: 0;
    left: 0;
    z-index: 1;
}

@keyframes markerPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    30% {
        opacity: 0.6;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Premium Dark-Theme Leaflet Popup Overrides - Globally Consistent */
.leaflet-popup-content-wrapper {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    padding: 6px !important;
}

.leaflet-popup-tip {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
}

.leaflet-popup-close-button {
    color: var(--text-secondary) !important;
    padding: 8px 10px 0 0 !important;
}

.leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

.leaflet-popup-content {
    margin: 12px 18px !important;
    line-height: 1.4 !important;
    color: var(--text-primary) !important;
}

/* Segmented Report & Date Navigation Styles */
.report-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.report-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--primary);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, var(--border) 0%, rgba(51, 65, 85, 0.2) 100%);
    margin: 2.5rem 0 1.5rem 0;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.35rem 0.75rem;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.date-navigation:hover {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
    background: rgba(30, 41, 59, 0.9);
}

.date-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.date-nav-btn svg {
    stroke: var(--text-secondary);
    transition: stroke 0.2s ease, transform 0.2s ease;
}

.date-nav-btn:hover {
    background: var(--primary-glow);
}

.date-nav-btn:hover svg {
    stroke: var(--primary);
}

#prevDateBtn:hover svg {
    transform: translateX(-2px);
}

#nextDateBtn:hover svg {
    transform: translateX(2px);
}

.report-date-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 0 0.5rem;
}

.report-date-picker {
    background: transparent;
    border: none;
    color: var(--primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    outline: none;
    color-scheme: dark;
    transition: all 0.2s ease;
}

.report-date-picker:hover {
    color: #818cf8;
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.report-date-picker::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(44%) sepia(91%) saturate(1478%) hue-rotate(218deg) brightness(99%) contrast(93%);
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.report-date-picker:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
    transform: scale(1.1);
}

/* loading indicators and skeletons */
.loading-pulse {
    animation: kpiPulse 1.5s infinite ease-in-out;
}

@keyframes kpiPulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* ==================== RESPONSIVE NAVIGATION & LAYOUTS ==================== */

/* Navigation Desktop Elements */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-user-panel {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 1px solid var(--border);
    padding-left: 1.5rem;
}

.nav-user-info {
    text-align: right;
    line-height: 1.2;
}

.nav-user-email {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.nav-user-role {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.btn-logout {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid var(--border);
    background: transparent;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--danger-glow);
    border-color: var(--danger);
    color: var(--danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.btn-change-password {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid var(--border);
    background: transparent;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.btn-change-password:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

/* Pancake Menu Button (Hamburger) */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 22px;
    height: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.nav-toggle .bar {
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Toggle Animations */
.nav-toggle.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    background-color: var(--primary);
}

.nav-toggle.active .bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.nav-toggle.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    background-color: var(--primary);
}

/* Responsive Overrides (Tablets and Mobiles) */
@media (max-width: 1200px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-content {
        padding: 1rem 1.5rem;
        position: relative;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        padding: 1.5rem;
        gap: 1.5rem;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
        opacity: 0;
        transform: translateY(-10px);
        pointer-events: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 99;
    }
    
    .nav-menu.active {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .nav-links a {
        display: block;
        padding: 0.75rem 1rem;
        width: 100%;
    }
    
    .nav-links a.active {
        border-bottom: none;
        border-left: 3px solid var(--primary);
        border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
        background-color: var(--bg-surface);
    }
    
    .nav-user-panel {
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 1.5rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .nav-user-info {
        text-align: left;
    }
}

@media (max-width: 768px) {
    main {
        padding: 1.5rem 1rem;
    }
    
    /* Deliveries & Region Map Responsive Stack */
    .deliveries-container {
        display: flex;
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    .deliveries-map {
        height: 380px !important;
        flex: none !important;
        border-radius: var(--radius-md);
        border: 1px solid var(--border);
    }
    
    #map-container {
        height: 380px !important;
    }
    
    .map-control-overlay,
    .map-overlay-panel {
        position: relative !important;
        top: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: none !important;
        margin-top: 1.5rem !important;
        margin-bottom: 1rem !important;
        border-radius: var(--radius-md) !important;
        box-shadow: none !important;
        background: var(--bg-surface) !important;
    }
    
    .timeline-control-container {
        position: relative !important;
        bottom: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: none !important;
        margin-top: 1rem !important;
        border-radius: var(--radius-md) !important;
        box-shadow: none !important;
        background: var(--bg-surface) !important;
    }
    
    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* Form controls alignment on mobile */
    .form-group {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .report-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .date-navigation {
        width: 100%;
        justify-content: space-between;
    }
}

/* ==================== GLOBAL RESPONSIVENESS OVERRIDES ==================== */

/* Standard Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1.5rem;
}

.header-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Update Pill Alert */
.update-pill {
    font-size: 0.85rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

/* Dashboard Actions Workflow */
.dashboard-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    width: 100%;
}

.dashboard-actions .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
}

/* Responsive Scaling Queries */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .page-header .btn,
    .page-header button,
    .page-header .update-pill {
        width: 100%;
        justify-content: center;
    }
    
    .card {
        padding: 1.25rem;
    }
}

@media (max-width: 600px) {
    .dashboard-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .dashboard-actions .btn {
        width: 100%;
        flex: none;
    }
    
    .report-charts-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-container, 
    .driver-stat-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 1rem;
    }
    
    .modal-card {
        width: 95% !important;
        margin: 10px auto;
        padding: 1.5rem !important;
    }
    
    .draw-instruction {
        width: calc(100% - 20px) !important;
        padding: 0.5rem 1rem !important;
        border-radius: var(--radius-md) !important;
        font-size: 0.8rem !important;
    }
}

/* ==================== PROFILE DROPDOWN STYLING ==================== */

/* Profile Dropdown Container */
.profile-dropdown {
    position: relative;
    display: inline-block;
    border-left: 1px solid var(--border);
    padding-left: 1.5rem;
    margin-left: 0.5rem;
}

/* Profile Button */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 0.25rem 0.65rem 0.25rem 0.25rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.profile-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

.profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary-glow);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 50%;
    color: var(--primary);
}

.profile-btn-chevron {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.profile-dropdown.active .profile-btn-chevron {
    transform: rotate(180deg);
}

/* Floating Menu Panel */
.profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.75rem);
    width: 240px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg), 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 0.5rem 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Content */
.profile-menu-header {
    padding: 0.75rem 1.25rem;
}

.profile-menu-email {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-role {
    font-size: 0.7rem;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.profile-menu-divider {
    height: 1px;
    background-color: var(--border);
    margin: 0.5rem 0;
}

.profile-menu-links {
    list-style: none;
    padding: 0 0.25rem;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.profile-menu-item:hover {
    background-color: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.profile-menu-item svg {
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.profile-menu-item:hover svg {
    color: var(--primary);
}

.profile-menu-item.logout-item:hover {
    background-color: var(--danger-glow);
    color: var(--danger);
}

.profile-menu-item.logout-item:hover svg {
    color: var(--danger);
}

/* Mobile Accoridon Adaptation for Drawer */
@media (max-width: 1024px) {
    .profile-dropdown {
        width: 100%;
        margin-left: 0;
        margin-top: 1rem;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 1rem;
    }
    
    .profile-btn {
        width: 100%;
        justify-content: space-between;
        background: rgba(30, 41, 59, 0.5);
        border-radius: var(--radius-md);
        padding: 0.5rem 1rem;
    }
    
    .profile-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        background: transparent;
        border: none;
        padding: 0;
        margin-top: 0.5rem;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }
    
    .profile-menu.active {
        display: block;
    }
    
    .profile-menu-header {
        padding: 0.5rem 0.75rem;
    }
    
    .profile-menu-divider {
        display: none;
    }
}



