/* ==========================================================================
   Fetch It - Admin Panel Custom CSS
   ========================================================================== */

.admin-body {
    background-color: var(--bg-darker);
    padding-bottom: 60px;
}

.admin-header {
    background: rgba(15, 23, 42, 0.9);
}

.badge-admin {
    font-size: 0.75rem;
    padding: 3px 8px;
    background: var(--color-yellow-glow);
    border: 1px solid var(--color-yellow);
    color: var(--color-yellow);
    border-radius: 4px;
    margin-left: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.admin-status-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.green {
    background-color: #22c55e;
    box-shadow: 0 0 10px #22c55e;
}

.animate-flicker {
    animation: flicker 2s infinite ease-in-out;
}

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

.active-orders-pill {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 6px 14px;
    border-radius: 50px;
    color: var(--color-cyan);
}

/* Admin Workspace Grid */
.admin-workspace {
    padding-top: 120px;
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.controls-row h1 {
    font-size: 2rem;
    font-weight: 800;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.dispatch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.1fr;
    gap: 20px;
    height: calc(100vh - 220px);
    min-height: 550px;
}

.dispatch-col {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-height: 0; /* Constraints height inside the grid row to allow shrinking */
}

.col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-glass);
}

.col-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 1.5s infinite ease-in-out;
}

.pulse-indicator.bg-red {
    background-color: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

@keyframes pulse {
    0%, 100% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

.col-count {
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Scrollable card lists */
.orders-list, .runners-list, .deliveries-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 4px;
    min-height: 0; /* Crucial to let the lists shrink and scroll instead of expanding content */
}

/* Scrollbar adjustment for column lists */
.orders-list::-webkit-scrollbar, .runners-list::-webkit-scrollbar, .deliveries-list::-webkit-scrollbar {
    width: 4px;
}

/* Card Designs */
.admin-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
}

.admin-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Card selected highlights */
.admin-card.selected {
    background: rgba(6, 182, 212, 0.07);
    border-color: var(--color-cyan);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.card-id {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.card-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.card-badge.express {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.card-badge.standard {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-glass);
}

.card-badge.buy {
    background: rgba(234, 179, 8, 0.1);
    color: var(--color-yellow);
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.card-details {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-route {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.route-step {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 8px;
}

.price-tag-sm {
    color: var(--color-yellow);
}

/* Runner specific styles */
.runner-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 85px;
    padding: 12px 14px;
}

.runner-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 55%;
}

.runner-name {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.25;
    color: var(--text-light);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.runner-details {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.runner-status-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.runner-card .btn-assign {
    padding: 4px 8px;
    font-size: 0.7rem;
    border-radius: 4px;
}

.runner-card .runner-status-indicator {
    font-size: 0.65rem;
    padding: 2px 6px;
}

.runner-status-indicator {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 50px;
}

.runner-status-indicator.available {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.runner-status-indicator.busy {
    background: rgba(234, 179, 8, 0.1);
    color: var(--color-yellow);
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.runner-status-indicator.offline {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-glass);
}

.runner-card.offline {
    opacity: 0.5;
}

.runner-card.offline:hover {
    opacity: 0.8;
}

.btn-assign {
    background: var(--color-cyan);
    color: var(--text-dark);
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: var(--transition-smooth);
}

.btn-assign:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--color-cyan-glow);
}

.btn-assign:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

/* Active delivery details styles */
.delivery-runner-meta {
    font-size: 0.8rem;
    color: var(--color-cyan);
    margin-bottom: 8px;
    font-weight: 500;
}

.progress-container {
    margin-top: 12px;
}

.progress-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-cyan), var(--color-yellow));
    transition: width 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Modal Overlay Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 6, 12, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card {
    padding: 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
}

.modal-card h3 {
    font-size: 1.35rem;
    margin-bottom: 16px;
}

.modal-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Financial Analytics Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 20px;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 8px;
    font-family: var(--font-heading);
}

@media (max-width: 992px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 576px) {
    .stats-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Toast Notification Styles */
.toast-notification {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
    padding: 16px 20px;
    border-radius: 12px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    pointer-events: auto;
    animation: slideInRight 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transition: all 0.3s ease;
}

.toast-notification.warning {
    border-color: rgba(234, 179, 8, 0.4);
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.2);
}

.toast-notification.success {
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-close-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.toast-close-btn:hover {
    color: #fff;
}

/* Elite 5-Star Badge & Pulse Animations */
.badge-elite {
    background: linear-gradient(135deg, #f59e0b, #eab308);
    color: #0f172a;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
    animation: goldPulse 2s infinite alternate;
    vertical-align: middle;
}

@keyframes goldPulse {
    0% {
        box-shadow: 0 0 4px rgba(234, 179, 8, 0.3);
    }
    100% {
        box-shadow: 0 0 12px rgba(234, 179, 8, 0.7);
    }
}

/* Runner Stats Modal Custom Styling */
.modal-card-lg {
    padding: 32px;
    max-width: 680px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    text-align: left;
}

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 12px;
}

.modal-header-row h3 {
    font-size: 1.4rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    color: #fff;
}

.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.modal-stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.modal-stat-card i {
    font-size: 1.25rem;
    color: var(--color-cyan);
    margin-bottom: 8px;
}

.modal-stat-card h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.modal-stat-card p {
    font-size: 1.3rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: #fff;
}

.modal-stat-card.highlight p {
    color: var(--color-yellow);
}

.modal-table-wrapper {
    overflow-x: auto;
    margin-top: 16px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(0,0,0,0.1);
}

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

.modal-table th, .modal-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
}

.modal-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    background: rgba(15,23,42,0.8);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

/* ==========================================================================
   Leaflet Map Styling for Operations Command Map
   ========================================================================== */
#adminOpsMap {
    background: var(--bg-darker) !important;
}

#adminOpsMap .leaflet-tile-container img {
    filter: invert(90%) hue-rotate(180deg) brightness(90%) contrast(95%);
}

/* Custom Marker Styling for Operations Map */
.custom-ops-marker {
    background: transparent;
    border: none;
}

.marker-ops-pin {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -16px 0 0 -16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.marker-ops-pin i {
    transform: rotate(45deg);
    font-size: 12px;
    color: #0f172a;
}

/* Green for Available */
.marker-ops-pin.available {
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

/* Blue for Busy */
.marker-ops-pin.busy {
    background: #06b6d4;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
}

/* Gray for Offline */
.marker-ops-pin.offline {
    background: #64748b;
    box-shadow: 0 0 8px rgba(100, 116, 139, 0.4);
    opacity: 0.7;
}

/* Label for marker */
.marker-label {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border-glass);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    font-family: var(--font-body);
}

/* Pulse rings for active busy runners */
.pulse-ring-ops {
    position: absolute;
    border: 2px solid #06b6d4;
    border-radius: 50%;
    height: 100%;
    width: 100%;
    left: -2px;
    top: -2px;
    animation: marker-pulse-ops 2s ease-out infinite;
    opacity: 0;
    box-sizing: content-box;
}

@keyframes marker-pulse-ops {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Date Filter Panel styles */
.filter-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-select {
    background: rgba(10, 15, 30, 0.85);
    border: 1px solid var(--border-glass);
    padding: 10px 16px;
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    min-width: 220px;
    transition: var(--transition-smooth);
}

.filter-select:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.custom-date-container {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.custom-date-container.hidden {
    display: none !important;
    opacity: 0;
    transform: translateY(-5px);
}

.filter-input-date {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    padding: 8px 14px;
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    min-height: 38px;
}

.filter-input-date:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.btn-apply-filter {
    transition: var(--transition-smooth);
}

.btn-apply-filter:hover {
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.25);
    transform: translateY(-1px);
}

