/* Rangga Telemetrics Core Styling Sheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --primary-font: 'Inter', sans-serif;
    --mono-font: 'JetBrains Mono', monospace;
    
    /* Light Mode Tokens (Default) */
    --rt-bg: #f8f9fc;
    --rt-surface: #ffffff;
    --rt-surface-container: #ffffff;
    --rt-surface-low: #f1f3f9;
    --rt-surface-lowest: #ffffff;
    --rt-border: #e2e8f0;
    --rt-text-primary: #0f172a;
    --rt-text-secondary: #475569;
    --rt-text-muted: #94a3b8;
    --rt-brand: #0d6efd;
    --rt-brand-hover: #0b5ed7;
    --rt-sidebar-bg: #ffffff;
    --rt-sidebar-border: #e2e8f0;
    --rt-active-item: rgba(13, 110, 253, 0.08);
    --rt-map-overlay: rgba(255, 255, 255, 0.9);
}

[data-bs-theme="dark"] {
    /* Dark Mode Tokens */
    --rt-bg: #090b10;
    --rt-surface: #11141e;
    --rt-surface-container: #161a27;
    --rt-surface-low: #1d2232;
    --rt-surface-lowest: #0c0e14;
    --rt-border: #232a3f;
    --rt-text-primary: #f8fafc;
    --rt-text-secondary: #cbd5e1;
    --rt-text-muted: #64748b;
    --rt-brand: #3b82f6;
    --rt-brand-hover: #2563eb;
    --rt-sidebar-bg: #11141e;
    --rt-sidebar-border: #232a3f;
    --rt-active-item: rgba(59, 130, 246, 0.12);
    --rt-map-overlay: rgba(22, 26, 39, 0.9);
}

* {
    font-family: var(--primary-font);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

body {
    background-color: var(--rt-bg);
    color: var(--rt-text-primary);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--rt-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--rt-text-muted);
}

/* Sidebar Styling */
.rt-sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--rt-sidebar-bg);
    border-right: 1px solid var(--rt-sidebar-border);
    z-index: 1020;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.rt-sidebar-brand {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--rt-sidebar-border);
}

.rt-sidebar-brand img {
    height: 32px;
}

.rt-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.rt-nav-header {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rt-text-muted);
    padding: 1.5rem 1.25rem 0.5rem 1.25rem;
    display: block;
    user-select: none;
}

.rt-nav-header:first-of-type {
    padding-top: 0.5rem;
}


.rt-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1.25rem;
    color: var(--rt-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.rt-nav-link:hover {
    background-color: var(--rt-surface-low);
    color: var(--rt-text-primary);
}

.rt-nav-link.active {
    background-color: var(--rt-active-item);
    color: var(--rt-brand);
    border-left-color: var(--rt-brand);
    font-weight: 600;
}

.rt-sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--rt-sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Content Frame layout */
.rt-main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.rt-top-navbar {
    height: 70px;
    background-color: var(--rt-surface);
    border-bottom: 1px solid var(--rt-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1010;
}

.rt-content-body {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--rt-bg);
}

/* Material Icons utility */
.material-icons-round {
    font-size: 1.25rem;
    vertical-align: middle;
}

/* Layout for full map views (tracking, playback, geofencing) */
.map-full-container {
    height: calc(100vh - 70px);
    position: relative;
    overflow: hidden;
    display: flex;
}

.map-sidebar {
    width: 320px;
    background-color: var(--rt-surface);
    border-right: 1px solid var(--rt-border);
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0,0,0,0.02);
}

.map-view-area {
    flex: 1;
    height: 100%;
    position: relative;
}

/* Floating overlay designs */
.map-floating-card {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background-color: var(--rt-map-overlay);
    backdrop-filter: blur(8px);
    border: 1px solid var(--rt-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.map-floating-right-card {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    max-width: 300px;
}

/* Telemetry Drawer Overlay style */
.telemetry-bottom-drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--rt-surface);
    border-top: 1px solid var(--rt-border);
    z-index: 1000;
    box-shadow: 0 -4px 25px rgba(0,0,0,0.06);
    transition: transform 0.3s ease;
}

/* Asset List items styling */
.rt-asset-item {
    border-bottom: 1px solid var(--rt-border);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rt-asset-item:hover {
    background-color: var(--rt-surface-low);
}

.rt-asset-item.active {
    background-color: var(--rt-active-item);
    border-left: 4px solid var(--rt-brand);
    padding-left: calc(1rem - 4px);
}

/* Custom styled badge classes */
.badge-status {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25em 0.6em;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.bg-moving-light {
    background-color: rgba(25, 135, 84, 0.12);
    color: #198754;
}

.bg-stationary-light {
    background-color: rgba(255, 193, 7, 0.15);
    color: #ff9f0a;
}

.bg-offline-light {
    background-color: rgba(108, 117, 125, 0.12);
    color: #6c757d;
}

.bg-alarm-light {
    background-color: rgba(220, 53, 69, 0.12);
    color: #dc3545;
}

/* Pulse animation on Leaflet maps */
.gps-pulse-icon {
    position: relative;
}

.gps-pulse-dot {
    width: 14px;
    height: 14px;
    background-color: var(--rt-brand);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.gps-pulse-ring {
    width: 32px;
    height: 32px;
    border: 3px solid var(--rt-brand);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: gpsPulseAnim 1.8s infinite ease-out;
    opacity: 0;
}

@keyframes gpsPulseAnim {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0;
    }
}

/* Custom styled forms & cards */
.rt-card {
    background-color: var(--rt-surface);
    border: 1px solid var(--rt-border);
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.02);
}

.form-control, .form-select {
    border-color: var(--rt-border);
    background-color: var(--rt-surface-container);
    color: var(--rt-text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--rt-brand);
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.15);
    background-color: var(--rt-surface-container);
    color: var(--rt-text-primary);
}

/* Monospace font text formatting */
.font-mono-data {
    font-family: var(--mono-font) !important;
}

/* Responsive sidebars for tablets and phones */
@media (max-width: 1024px) {
    .rt-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .rt-sidebar.show {
        transform: translateX(0);
    }
    .rt-main-wrapper {
        margin-left: 0 !important;
    }
}

/* Desktop Sidebar Collapse overrides */
@media (min-width: 1025px) {
    html.sidebar-collapsed .rt-sidebar {
        transform: translateX(-260px);
    }
    html.sidebar-collapsed .rt-main-wrapper {
        margin-left: 0;
    }
}

/* Header Action Buttons styling */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--rt-text-secondary);
    background: transparent;
    border: 1px solid transparent;
    position: relative;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background-color: var(--rt-surface-low);
    color: var(--rt-text-primary);
}

.btn-icon:focus {
    box-shadow: none;
}

.btn-icon .material-icons-round {
    font-size: 1.35rem;
}

/* Adjust top navbar padding */
.rt-top-navbar {
    padding: 0 1.25rem;
}

/* ── Leaflet: custom tooltip matching design system ─────────────── */
.leaflet-tooltip.rt-tooltip {
    background: var(--rt-surface) !important;
    border: 1px solid var(--rt-border) !important;
    color: var(--rt-text-primary) !important;
    border-radius: 6px !important;
    font-family: var(--primary-font) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 3px 8px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,.08) !important;
    white-space: nowrap;
}
.leaflet-tooltip.rt-tooltip::before {
    border-top-color: var(--rt-border) !important;
}

/* ── Leaflet: z-index fix ────────────────────────────────────────── */
.leaflet-pane { z-index: 400 !important; }
.leaflet-top, .leaflet-bottom { z-index: 500 !important; }

/* ── Reusable Toast Notification System ─────────────────────────────────── */
.rt-toast-container {
    position: fixed;
    top: 85px; /* Sedikit di bawah navbar */
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.rt-toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 400px;
    background: var(--rt-map-overlay);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--rt-border);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
    opacity: 0;
}
.rt-toast.show {
    transform: translateX(0);
    opacity: 1;
}
.rt-toast.hide {
    transform: translateX(120%);
    opacity: 0;
}
.rt-toast-success {
    border-left: 4px solid #198754;
}
.rt-toast-success .rt-toast-icon {
    color: #198754;
}
.rt-toast-error {
    border-left: 4px solid #dc3545;
}
.rt-toast-error .rt-toast-icon {
    color: #dc3545;
}
.rt-toast-warning {
    border-left: 4px solid #ffc107;
}
.rt-toast-warning .rt-toast-icon {
    color: #ffc107;
}
.rt-toast-info {
    border-left: 4px solid #0d6efd;
}
.rt-toast-info .rt-toast-icon {
    color: #0d6efd;
}
.rt-toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.rt-toast-content {
    flex: 1;
}
.rt-toast-message {
    font-size: 13px;
    font-weight: 500;
    color: var(--rt-text-primary);
}
