/* MAP LAYOUT */
.dispatch-icon {
    position: absolute;
    right: 0;
    z-index: 9;
    top: 60px;
}

.map-controls-left {
    position: absolute;
    top: 100px;
    left: 15px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.map-btn {
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    font-size: 20px;
}

.map-btn.rotate {
    animation: spin 1s linear infinite;
}

.numberCircle {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff3b3b;
    color: #fff;
    width: 22px;
    height: 22px;
    font-size: 12px;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* MODERN DRIVER CARD (MAP) */
.driver-info-card {
    font-family: 'Inter', sans-serif;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    border: 1px solid #eaeaea;
}

.driver-info-card .name {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 13px;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.driver-info-card .vehicle {
    font-size: 11px;
    font-weight: 500;
    color: #444;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* STATUS BADGES */
.status-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    float: right;
}

/* Green - Available for trips */
.status-free {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #166534;
}

/* Orange - Logged in / Active */
.status-active {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #c2410c;
}

/* Red - Currently on a trip */
.status-busy {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #b91c1c;
}

.status-idle {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #94a3b8;
}

.status-offline {
    background: #f9fafb;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

/* SIDEBAR STYLING */
.custom-dispatch-sidebar {
    height: 100vh;
    width: 500px !important;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

.sidebar-tabs-container {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.side-tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    color: #64748b;
    transition: 0.2s;
}

.custom-dispatch-sidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    /* IMPORTANT */
}

.side-tab-btn.active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filter-pill-container {
    padding: 10px;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.f-pill {
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.f-pill.active {
    background: #1e293b;
    color: #fff;
    border-color: #1e293b;
}

.dispatch-item-card {
    padding: 15px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: 0.2s;
    background: white;
}

.dispatch-item-card:hover {
    background: #f8fafc;
}

.dispatch-item-card .title {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
}

.dispatch-item-card .subtitle {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

/* MAP FILTER BAR */
.map-filter {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 6px;
    border-radius: 50px;
    display: flex;
    gap: 5px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.map-filter button {
    border: none;
    background: transparent;
    padding: 8px 18px;
    border-radius: 40px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.map-filter button.active {
    background: #1a1a1a;
    color: #fff;
}

/* GOOGLE MAPS FIXES */
/* Container styling */
.gm-style-iw-c {
    padding: 0 !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

/* Hide the default padding of the content area */
.gm-style-iw-d {
    overflow: hidden !important;
    padding: 0 !important;
}

/* The Close Button Container */
.gm-style-iw-chr {
    position: absolute !important;
    top: 0;
    right: 0;
    width: 100%;
    height: 35px;
    /* Define a height for the header area */
    display: flex;
    align-items: center;
    z-index: 1;
}

/* Positioning the name inside that top area */
/* Header Link Styling */
.custom-iw-header a:hover {
    color: #2563eb !important;
}

.custom-iw-header a:hover span {
    border-bottom: 1px solid #2563eb !important;
}

.custom-iw-header {
    position: absolute;
    top: 10px;
    left: 12px;
    font-size: 13px;
    font-weight: 800;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

/* Status Badge Styling */
.status-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Move the default Google close button slightly for better alignment */
.gm-ui-hover-effect {
    top: 2px !important;
    right: 2px !important;
    background-color: transparent !important;
}

/* .gm-ui-hover-effect {
    display: none !important;
} */


#driverCountsSection {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}


/* Logic Tooltip Styling */
[title] {
    position: relative;
    cursor: help;
}

/* Detail Row Text Colors */
.text-active {
    color: #06b6d4;
}

.text-busy {
    color: #f59e0b;
}

.text-free {
    color: #10b981;
}

.text-idle {
    color: #f97316;
}

/* Elevated Item Cards */
.dispatch-item-card {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.dispatch-item-card:hover {
    background: #f8fafc;
    border-left-color: var(--primary);
    transform: translateX(4px);
}

.dispatch-item-card .title {
    color: var(--text-main);
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}

.dispatch-item-card .subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dispatch-item-card .subtitle i {
    width: 18px;
    color: var(--primary);
    opacity: 0.7;
}

/* Enhanced Booking Card */
.booking-card {
    background: #fff;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease-in-out;
    position: relative;
}

.booking-card:hover {
    border-color: #3182ce;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.booking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.trip-id {
    font-family: 'Monaco', monospace;
    font-weight: 700;
    color: #2d3748;
    background: #f7fafc;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.type-badge {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
}

/* Trip Type Colors */
.type-local {
    background: #ebf8ff;
    color: #3182ce;
}

.type-rental {
    background: #faf5ff;
    color: #805ad5;
}

.type-outstation {
    background: #fffaf0;
    color: #dd6b20;
}

.passenger-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f7fafc;
}

.location-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #4a5568;
}

.loc-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.loc-item i {
    margin-top: 3px;
    font-size: 14px;
}

/* Vertical Route Line */
.route-timeline {
    position: relative;
    padding-left: 24px;
    margin: 12px 0;
    overflow: hidden;
    width: 100%;
}

.route-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: #e2e8f0;
    border-radius: 2px;
}

.timeline-dot {
    position: absolute;
    left: 3px;
    font-size: 10px;
}

/* Info Grid */
.booking-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

.grid-item {
    display: flex;
    flex-direction: column;
}

.grid-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
}

.grid-value {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

/* Status Pill */
.status-pill {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}

/* Compact Layout Additions */
.otp-badge {
    background: #fff5f5;
    color: #e53e3e;
    border: 1px dashed #feb2b2;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    font-size: 15px;
}

.vehicle-info {
    font-size: 11px;
    color: #4a5568;
    background: #edf2f7;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
    display: inline-block;
}

.person-box {
    padding: 8px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
}

.label-tiny {
    font-size: 9px;
    text-transform: uppercase;
    color: #94a3b8;
    display: block;
    margin-bottom: 2px;
}

/* Truncation Fix */
.text-truncate-custom {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    /* Adjust based on your sidebar width */
}

/* Vibrant Trip Type Badges */
.badge-vibrant {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: none;
}

/* Specific Colors */
.vibrant-local {
    background-color: #4361ee;
    color: #ffffff;
}

.vibrant-rental {
    background-color: #7209b7;
    color: #ffffff;
}

.vibrant-outstation {
    background-color: #f72585;
    color: #ffffff;
}

.filter-box {
    cursor: pointer;
    padding: 8px 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    background: transparent;
}

.filter-box:hover {
    background: rgba(0, 0, 0, 0.03);
}

.filter-box.active {
    background: rgba(30, 41, 59, 0.05);
    border-bottom-color: #1e293b;
}

.filter-box.active .small {
    color: #000 !important;
}

.filter-box.active .status-filter {
    transform: scale(1.1);
    display: inline-block;
}

.text-active {
    color: #06b6d4 !important;
}

.text-busy {
    color: #f59e0b !important;
}

.text-free {
    color: #10b981 !important;
}

.text-idle {
    color: #f97316 !important;
}

.skeleton-card {
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.5) 20%,
            rgba(255, 255, 255, 0.5) 60%,
            rgba(255, 255, 255, 0));
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Skeleton Lines */
.skeleton-line {
    background: #f1f5f9;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-line.title {
    width: 60%;
    height: 18px;
}

.skeleton-line.subtitle {
    width: 40%;
    height: 12px;
}

.skeleton-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 60px;
    height: 24px;
    background: #f1f5f9;
    border-radius: 12px;
}

.booking-skeleton-card {
    padding: 16px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
    overflow: hidden;
}

.booking-skeleton-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.6) 20%,
            rgba(255, 255, 255, 0.6) 60%,
            rgba(255, 255, 255, 0));
    animation: booking-shimmer 2s infinite;
}

@keyframes booking-shimmer {
    100% {
        transform: translateX(100%);
    }
}

.skeleton-line {
    background: #f1f5f9;
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-line.title {
    width: 50%;
    height: 16px;
}

.skeleton-line.small-badge {
    width: 70px;
    height: 20px;
    border-radius: 10px;
}

.skeleton-line.detail {
    width: 85%;
    height: 12px;
}

.skeleton-btn {
    width: 80px;
    height: 30px;
    background: #f1f5f9;
    border-radius: 6px;
}

.custom-dispatch-sidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

#driverCountsSection,
#bookingCountsSection {
    flex-shrink: 0;
    background: #fff;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.p-3.bg-light.border-bottom {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.list-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

.dispatch-item-card {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.side-tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* Space between text and icon */
}

.tab-refresh-icon {
    font-size: 12px;
    opacity: 0.6;
    transition: transform 0.3s ease, opacity 0.2s;
    cursor: pointer;
}

.side-tab-btn:hover .tab-refresh-icon {
    opacity: 1;
    color: #1e293b;
}

/* Class to trigger via JavaScript during AJAX load */
.tab-refresh-icon.spinning {
    animation: spin 1s linear infinite;
}