/* IoT GPS Tracker - Light Theme CSS (Flat Design) */

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #3b82f6;
    --accent-light: #eff6ff;
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --border-color: #e2e8f0;
    --radius: 8px;
    --sidebar-width: 260px;
    --header-height: 60px;
    --footer-height: 48px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-secondary);
    border-radius: 6px;
}

.sidebar-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-close-btn svg {
    width: 20px;
    height: 20px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-logo-text span {
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 8px 12px 6px;
    margin-top: 8px;
}

.nav-section-title:first-child {
    margin-top: 0;
}

/* Regular nav items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    margin-bottom: 2px;
    font-weight: 500;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-item.active svg {
    color: var(--accent);
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
}

.nav-item-text {
    font-size: 14px;
    flex: 1;
}

.nav-item-badge {
    margin-left: auto;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.nav-item-badge.danger {
    background: var(--danger);
    color: white;
}

/* Collapsible nav groups */
.nav-group {
    margin-bottom: 2px;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 14px;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.nav-group-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-group.open>.nav-group-toggle {
    color: var(--text-primary);
}

.nav-group-chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    font-size: 12px;
}

.nav-group.open>.nav-group-toggle .nav-group-chevron {
    transform: rotate(180deg);
}

/* Collapsible children */
.nav-group-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-left: 20px;
}

.nav-group.open>.nav-group-children {
    max-height: 300px;
}

.nav-child-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    margin-bottom: 1px;
}

.nav-child-item:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-child-item.active {
    color: var(--accent);
    font-weight: 600;
}

.nav-child-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    flex-shrink: 0;
}

.nav-child-item.active .nav-child-dot {
    background: var(--accent);
}

.nav-child-item:hover .nav-child-dot {
    background: var(--text-secondary);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--success-light);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--success);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.header-time {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 6px;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--footer-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 998;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.footer-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-brand {
    font-weight: 600;
    color: var(--text-primary);
}

.footer-separator {
    color: var(--border-color);
}

.footer-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.footer-right {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    padding: 24px;
    padding-bottom: calc(var(--footer-height) + 24px);
    background: var(--bg-primary);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile Menu Button (hidden on desktop) */
.mobile-menu-btn {
    display: none;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    border-radius: 6px;
}

.mobile-menu-btn svg {
    width: 22px;
    height: 22px;
}

.mobile-menu-btn:hover {
    background: var(--bg-tertiary);
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close-btn {
        display: flex;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .header {
        left: 0;
        padding: 0 16px;
    }

    .header-title {
        font-size: 16px;
    }

    .header-actions {
        gap: 8px;
    }

    .header-status span:last-child {
        display: none;
    }

    .header-time {
        display: none;
    }

    .main-content {
        padding: 16px;
        padding-bottom: calc(var(--footer-height) + 16px);
    }

    .footer {
        left: 0;
    }
}

/* Cards - Flat Design */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* Stats Grid - Flat Design like the image */
.stats-grid {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 180px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg,
.stat-icon i {
    width: 20px;
    height: 20px;
    font-size: 18px;
}

.stat-icon.blue {
    background: var(--accent-light);
    color: var(--accent);
}

.stat-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.orange {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon.purple {
    background: var(--purple-light);
    color: var(--purple);
}

.stat-icon.red {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-info p {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    order: -1;
}

.stat-info h3 {
    font-size: 22px;
    font-weight: 700;
}

/* Map Container */
.map-container {
    height: calc(100vh - var(--header-height) - var(--footer-height) - 180px);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
}

/* Ensure Leaflet controls stay inside map */
.leaflet-left {
    left: 10px !important;
}

.leaflet-control {
    z-index: 400 !important;
}

/* Device List */
.device-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.device-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    transition: all 0.15s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
}

.device-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.device-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.device-icon svg {
    width: 20px;
    height: 20px;
}

.device-info {
    flex: 1;
}

.device-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.device-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.device-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--success);
    background: var(--success-light);
    padding: 4px 10px;
    border-radius: 12px;
}

.device-status.offline {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

/* History Table */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.history-table th:first-child {
    border-radius: 6px 0 0 6px;
}

.history-table th:last-child {
    border-radius: 0 6px 6px 0;
}

.history-table tr:hover td {
    background: var(--bg-tertiary);
}

.history-table td {
    font-size: 13px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Outfit', sans-serif;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
    opacity: 0.9;
}

/* Select */
select.btn {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

/* Custom Select Component (Alpine.js) */
.custom-select-wrapper {
    position: relative;
    min-width: 200px;
}

.custom-select-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-select-btn:hover {
    border-color: var(--accent);
}

.custom-select-btn.active {
    border-color: var(--accent);
}

.custom-select-btn .select-arrow {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.custom-select-btn .select-arrow.rotate {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}

.custom-select-options {
    padding: 4px 0;
}

.custom-select-option {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    font-size: 14px;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.1s ease;
}

.custom-select-option:hover {
    background: var(--bg-tertiary);
}

.custom-select-option.selected {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-light);
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .header {
        left: 0;
        padding: 0 16px;
    }

    .header-title {
        font-size: 16px;
    }

    .header-actions {
        gap: 8px;
    }

    .header-status span:last-child {
        display: none;
    }

    .header-time {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .footer {
        left: 0;
        padding: 0 16px;
    }

    .footer-left .footer-text,
    .footer-separator {
        display: none;
    }

    .stats-grid {
        flex-direction: column;
    }

    .stat-card {
        min-width: 100%;
    }

    .map-container {
        height: calc(100vh - var(--header-height) - var(--footer-height) - 220px);
    }
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex !important;
    }
}

/* Overlay for mobile menu */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Leaflet Overrides */
.leaflet-container {
    background: var(--bg-primary);
    font-family: 'Outfit', sans-serif;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}

.leaflet-popup-tip {
    background: var(--bg-secondary);
}

.leaflet-control-zoom {
    z-index: 400 !important;
}

.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.leaflet-control-attribution {
    background: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
}

/* ========================= */
/* Service Kendaraan Styles  */
/* ========================= */

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}

.alert-success {
    background: var(--success-light);
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: var(--danger-light);
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Vehicle Grid */
.vehicle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.vehicle-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
}

.vehicle-card:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.vehicle-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.vehicle-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vehicle-type-icon svg {
    width: 20px;
    height: 20px;
}

.vehicle-type-icon.motor {
    background: var(--purple-light);
    color: var(--purple);
}

.vehicle-type-icon.mobil {
    background: var(--accent-light);
    color: var(--accent);
}

.vehicle-type-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.vehicle-type-badge.motor {
    background: var(--purple-light);
    color: var(--purple);
}

.vehicle-type-badge.mobil {
    background: var(--accent-light);
    color: var(--accent);
}

.vehicle-card-body {
    flex: 1;
    margin-bottom: 14px;
}

.vehicle-card-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.vehicle-plate {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.vehicle-card-meta {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.vehicle-card-meta span:not(:last-child)::after {
    content: "•";
    margin-left: 8px;
}

.vehicle-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.vehicle-odometer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.vehicle-warning-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--danger-light);
    color: var(--danger);
}

.vehicle-caution-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--warning-light);
    color: var(--warning);
}

.vehicle-ok-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--success-light);
    color: var(--success);
}

/* Vehicle Info Grid */
.vehicle-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.info-item {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.info-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
}

/* Service Status Progress */
.service-status-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.service-status-item {
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.service-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.service-status-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.service-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.service-status-dot.success {
    background: var(--success);
}

.service-status-dot.warning {
    background: var(--warning);
}

.service-status-dot.danger {
    background: var(--danger);
    animation: pulse 1.5s infinite;
}

.service-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.service-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.service-progress-fill.success {
    background: var(--success);
}

.service-progress-fill.warning {
    background: var(--warning);
}

.service-progress-fill.danger {
    background: var(--danger);
}

.km-remaining {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
}

.km-remaining.success {
    background: var(--success-light);
    color: var(--success);
}

.km-remaining.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.km-remaining.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.service-status-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Service History */
.service-history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.service-history-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.service-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.service-history-date {
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-date-badge {
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 8px;
    padding: 6px 12px;
    text-align: center;
    min-width: 60px;
}

.date-day {
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

.date-month {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.service-cost {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.service-items-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.service-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.service-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.service-item-cost {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.service-notes {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent);
}

/* Forms */
.service-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.required {
    color: var(--danger);
}

.form-input {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    transition: all 0.15s ease;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Type Selector */
.type-selector {
    display: flex;
    gap: 12px;
}

.type-option {
    flex: 1;
    cursor: pointer;
}

.type-option input[type="radio"] {
    display: none;
}

.type-option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    transition: all 0.15s ease;
}

.type-option-content svg {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.type-option-content span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.type-option input[type="radio"]:checked+.type-option-content {
    border-color: var(--accent);
    background: var(--accent-light);
}

.type-option input[type="radio"]:checked+.type-option-content svg {
    color: var(--accent);
}

.type-option input[type="radio"]:checked+.type-option-content span {
    color: var(--accent);
}

.type-option-content:hover {
    border-color: var(--accent);
}

/* Service Items Section (Form) */
.service-items-section {
    margin-bottom: 20px;
}

.service-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.quick-add-section {
    margin-bottom: 16px;
}

.quick-add-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.quick-add-btn {
    padding: 5px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-add-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.service-item-entry {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.service-item-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.service-item-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
    padding: 2px 8px;
    border-radius: 6px;
}

.btn-remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-light);
    color: var(--danger);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-remove:hover {
    background: var(--danger);
    color: white;
}

.total-cost-section {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-top: 16px;
}

/* Responsive for service pages */
@media (max-width: 768px) {
    .vehicle-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: 1;
    }

    .vehicle-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .service-history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .service-status-meta {
        flex-direction: column;
        gap: 2px;
    }

    .type-selector {
        flex-direction: column;
    }
}

/* GPS Auto Badge */
.gps-auto-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    letter-spacing: 0.2px;
    vertical-align: middle;
    margin-left: 4px;
}

/* Notification Items */
.notif-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notif-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius);
    border-left: 4px solid;
    background: var(--bg-tertiary);
    gap: 12px;
}

.notif-item.danger {
    border-left-color: var(--danger);
    background: var(--danger-light);
}

.notif-item.warning {
    border-left-color: var(--warning);
    background: var(--warning-light);
}

.notif-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.notif-status-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-status-icon.danger {
    background: var(--danger);
    color: white;
}

.notif-status-icon.warning {
    background: var(--warning);
    color: white;
}

.notif-component-name {
    font-size: 14px;
    font-weight: 600;
}

.notif-component-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.notif-item-right {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .notif-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ======================== */
/* Map Legend Panel         */
/* ======================== */
.map-legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 280px;
    max-height: 320px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-legend-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.map-legend-header span {
    flex: 1;
}

.map-legend-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 12px;
    border-radius: 4px;
    transition: color 0.2s;
}

.map-legend-toggle:hover {
    color: var(--accent);
}

.map-legend-body {
    overflow-y: auto;
    max-height: 260px;
    transition: max-height 0.3s ease;
}

.map-legend-body.collapsed {
    max-height: 0;
    overflow: hidden;
}

.map-legend-loading,
.map-legend-empty {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
}

.map-legend-item:last-child {
    border-bottom: none;
}

.map-legend-item:hover {
    background: var(--bg-primary);
}

.legend-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid white;
    outline: 1px solid var(--border-color);
}

.legend-item-info {
    flex: 1;
    min-width: 0;
}

.legend-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-item-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-item-speed {
    font-size: 11px;
    color: var(--accent);
    margin-top: 2px;
    font-weight: 500;
}

.legend-item-speed i {
    font-size: 10px;
    margin-right: 2px;
}

@media (max-width: 768px) {
    .map-legend {
        width: 220px;
        bottom: 10px;
        left: 10px;
        max-height: 250px;
    }
}

/* Map container */
.map-container {
    position: relative;
}

#map {
    height: 500px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    #map {
        height: 400px;
    }
}