/* R4 Telemetria — Dashboard Custom Styles */

/* ---- Vehicle map markers ---- */
.vehicle-div-icon {
    background: none !important;
    border: none !important;
    overflow: visible !important;
}
.vmarker {
    position: absolute;
    bottom: 0;
    left: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}
.vmarker-label {
    background: var(--c, #6b7280);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    gap: 5px;
}
.vmarker-label span {
    font-size: 9px;
    opacity: 0.85;
}
.vmarker-arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--c, #6b7280);
}
.vmarker-dot {
    width: 8px;
    height: 8px;
    background: var(--c, #6b7280);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    margin-top: -3px;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 40;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.sidebar-nav a:hover {
    color: #f1f5f9;
    background: rgba(255,255,255,0.04);
}

.sidebar-nav a.active {
    color: #38bdf8;
    background: rgba(56,189,248,0.08);
    border-left-color: #38bdf8;
}

.sidebar-nav a .nav-icon {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
}

/* ---- Map ---- */
#map {
    height: 100%;
    width: 100%;
    border-radius: 0.5rem;
}

.fleet-summary-bar {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
    background: rgba(15,23,42,0.92);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.fleet-summary-bar .stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
}

.fleet-summary-bar .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-moving   { background: #22c55e; }
.dot-stopped  { background: #eab308; }
.dot-idle     { background: #9ca3af; }
.dot-offline  { background: #ef4444; }

/* ---- Vehicle Markers ---- */
.vehicle-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    transition: transform 0.2s;
}

.vehicle-marker:hover {
    transform: scale(1.3);
}

.marker-moving  { background: #22c55e; }
.marker-stopped { background: #eab308; }
.marker-idle    { background: #9ca3af; }
.marker-offline { background: #ef4444; }

/* ---- Status Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-moving   { background: #dcfce7; color: #166534; }
.badge-stopped  { background: #fef9c3; color: #854d0e; }
.badge-idle     { background: #f3f4f6; color: #4b5563; }
.badge-offline  { background: #fee2e2; color: #991b1b; }
.badge-paired   { background: #dcfce7; color: #166534; }
.badge-pending  { background: #fef9c3; color: #854d0e; }
.badge-no_data  { background: #f3f4f6; color: #6b7280; }

.badge-critical { background: #fee2e2; color: #991b1b; }
.badge-high     { background: #ffedd5; color: #9a3412; }
.badge-medium   { background: #fef9c3; color: #854d0e; }
.badge-low      { background: #dbeafe; color: #1e40af; }

/* ---- Cards ---- */
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* ---- Loading Spinner ---- */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: #64748b;
    font-size: 0.9rem;
}

/* ---- Gauge ---- */
.gauge-container {
    position: relative;
    width: 160px;
    height: 160px;
}

.gauge-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.gauge-value .number {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
}

.gauge-value .unit {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
}

/* ---- Route Map Fullscreen ---- */
.route-map-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    min-height: unset !important;
}

/* ---- Route Marker ---- */
.route-marker-icon {
    background: none !important;
    border: none !important;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .mobile-overlay {
        display: block;
    }
}

/* ---- Pulse animation for live indicators ---- */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.pulse {
    animation: pulse-dot 2s ease-in-out infinite;
}

/* ---- Tenant modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- Table ---- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: #f8fafc;
    padding: 0.6rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tbody td {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

/* ---- Empty State ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: #94a3b8;
    text-align: center;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ---- Card-based badge colors (for inline Tailwind fallbacks) ---- */
.badge-green { background: #dcfce7; color: #166534; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
