/* ============================================================
   GPS Tracker – Modern Premium Style (v2.0)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #25D366;
    --primary-dark: #128C7E;
    --primary-gradient: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    --dark: #0a0f1a;
    --dark-card: #141b2b;
    --dark-hover: #1f2a3f;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(37, 211, 102, 0.1);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #0a0f1a;
    color: #e2e8f0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---------- AUTH PAGES (Login/Register) ---------- */
.auth-page {
    background: linear-gradient(135deg, #0a0f1a 0%, #141b2b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card {
    background: linear-gradient(145deg, #141b2b, #0d1520);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 420px;
}
.auth-card .auth-title {
    color: #25D366;
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
}
.auth-card .auth-title i {
    margin-right: 10px;
}
.auth-card .form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
}
.auth-card .form-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}
.auth-card .form-control::placeholder {
    color: #64748b;
}
.auth-card label {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
}
.auth-card .btn-success {
    background: var(--primary-gradient);
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
}
.auth-card .btn-success:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3);
}

/* ---------- MODERN REGISTER LINK (CENTRE + BUTTON STYLE) ---------- */
.register-wrapper {
    margin-top: 24px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.register-text {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 12px;
}
.register-link {
    display: inline-block;
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    padding: 12px 40px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border: none;
    border-radius: 50px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
    position: relative;
    overflow: hidden;
}
.register-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}
.register-link:hover::before {
    left: 100%;
}
.register-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.45);
    color: #ffffff;
    text-decoration: none;
}
.register-link:active {
    transform: translateY(0);
}
.register-link i {
    margin-right: 8px;
    transition: transform 0.3s;
}
.register-link:hover i {
    transform: translateX(4px);
}
/* Mobile Responsive */
@media (max-width: 480px) {
    .register-link {
        padding: 10px 30px;
        font-size: 0.85rem;
        width: 100%;
        text-align: center;
        display: block;
    }
    .auth-card {
        padding: 24px;
        margin: 16px;
    }
    .auth-card .auth-title {
        font-size: 1.4rem;
    }
}

/* ---------- SIDEBAR TOGGLE ---------- */
.sidebar-toggle {
    display: none;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    font-size: 1.6rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1060;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.35);
    transition: var(--transition);
}
.sidebar-toggle:hover { transform: scale(1.05); box-shadow: 0 6px 30px rgba(37, 211, 102, 0.5); }
.sidebar-toggle:active { transform: scale(0.95); }

/* ---------- SIDEBAR ---------- */
.sidebar {
    width: 280px;
    min-height: 100vh;
    background: linear-gradient(180deg, #0d1520 0%, #0a0f1a 100%);
    color: #e2e8f0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 0 !important;
    z-index: 1050;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-header .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}
.sidebar-header .logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-header .logo-sub {
    font-size: 0.65rem;
    color: var(--text-secondary);
    -webkit-text-fill-color: #94a3b8;
    display: block;
    margin-top: -2px;
}

.sidebar .nav { padding: 16px 12px 20px; }
.sidebar .nav-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 12px 12px 6px;
    font-weight: 600;
}
.sidebar .nav-link {
    color: var(--text-secondary);
    padding: 10px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
}
.sidebar .nav-link i {
    width: 22px;
    font-size: 1.1rem;
    text-align: center;
    color: var(--text-muted);
    transition: var(--transition);
}
.sidebar .nav-link:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.sidebar .nav-link:hover i { color: var(--primary); }
.sidebar .nav-link.active {
    background: rgba(37, 211, 102, 0.12);
    color: #fff;
}
.sidebar .nav-link.active i { color: var(--primary); }
.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}
.sidebar .nav-link.text-danger { color: #ef4444 !important; }
.sidebar .nav-link.text-danger:hover { background: rgba(239, 68, 68, 0.12); color: #ef4444 !important; }

/* ---------- OVERLAY ---------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1040;
    backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

/* ---------- MOBILE TOP BAR ---------- */
.mobile-top-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 15, 26, 0.92);
    backdrop-filter: blur(20px);
    z-index: 1055;
    padding: 0 16px;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.mobile-app-name {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mobile-app-name i { color: var(--primary); }

/* ---------- CONTENT ---------- */
.content {
    background: #0a0f1a;
    min-height: 100vh;
    padding: 24px 28px !important;
    flex: 1;
    margin-left: 280px;
    overflow-x: hidden;
}

/* ---------- DASHBOARD HEADER ---------- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.dashboard-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.dashboard-header h3 i { color: var(--primary); }
.dashboard-header .user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dashboard-header .badge-online {
    background: rgba(37, 211, 102, 0.15);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid rgba(37, 211, 102, 0.2);
}
.dashboard-header .user-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

/* ---------- STATS CARDS ---------- */
.stats-row .card {
    background: linear-gradient(145deg, #141b2b, #0d1520);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    padding: 8px 0;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stats-row .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-gradient);
    opacity: 0.6;
}
.stats-row .card:hover {
    transform: translateY(-4px);
    border-color: rgba(37, 211, 102, 0.15);
    box-shadow: var(--shadow-glow);
}
.stats-row .card-body { padding: 16px 20px; }
.stats-row .card h6 {
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}
.stats-row .card h2 { font-size: 1.8rem; font-weight: 700; color: #fff; margin: 0; }
.stats-row .card h5 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin: 0; }

/* ---------- MAP ---------- */
#map {
    width: 100%;
    border-radius: var(--radius);
    height: 60vh;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #0d1520;
}
#map .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}
#map .leaflet-control-zoom a {
    background: #141b2b !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}
#map .leaflet-control-zoom a:hover { background: #1f2a3f !important; }

/* ---------- MAP CONTROLS ---------- */
.map-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.map-controls .badge {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 400;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.map-controls .badge.bg-success {
    background: rgba(37, 211, 102, 0.15) !important;
    color: var(--primary) !important;
}
.map-controls .btn {
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    transition: var(--transition);
}
.map-controls .btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.map-controls .btn-success {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
}
.map-controls .btn-success:hover { transform: scale(1.02); box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3); }

/* ---------- LAST LOCATION CARD ---------- */
.last-location-card {
    background: linear-gradient(145deg, #141b2b, #0d1520);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    padding: 20px;
}
.last-location-card h6 {
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 12px;
}
.last-location-card p { margin: 0; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.8; }
.last-location-card p strong { color: #fff; font-weight: 500; }
.last-location-card .place-text { color: var(--primary); font-weight: 500; font-size: 0.9rem; }
.last-location-card .state-text { color: var(--text-secondary); font-size: 0.85rem; }

/* ---------- CHARTS ---------- */
#dailyChart {
    background: linear-gradient(145deg, #141b2b, #0d1520);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.apexcharts-text { fill: var(--text-secondary) !important; }
.apexcharts-gridline { stroke: rgba(255, 255, 255, 0.05) !important; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .sidebar-toggle { display: block !important; top: 12px; left: 12px; font-size: 1.4rem; padding: 0.4rem 0.8rem; }
    .sidebar { left: -300px; width: 300px; }
    .sidebar.open { left: 0; }
    .sidebar-overlay.active { display: block; }
    .mobile-top-bar { display: flex !important; }
    .content { margin-left: 0 !important; padding: 16px !important; padding-top: 76px !important; }
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .dashboard-header h3 { font-size: 1.2rem; }
    .stats-row .card h2 { font-size: 1.4rem; }
    #map { height: 45vh; min-height: 280px; }
    .stats-row .card-body { padding: 12px 16px; }
}
@media (max-width: 480px) {
    .content { padding: 12px !important; padding-top: 68px !important; }
    .sidebar { width: 280px; left: -280px; }
    .stats-row .col-6 { padding: 0 6px; }
    .stats-row .card-body { padding: 10px 12px; }
    .stats-row .card h2 { font-size: 1.2rem; }
    .stats-row .card h6 { font-size: 0.6rem; }
    .dashboard-header h3 { font-size: 1rem; }
    #map { height: 38vh; min-height: 200px; }
    .register-link {
        padding: 8px 20px;
        font-size: 0.85rem;
        width: 100%;
        text-align: center;
    }
    .auth-card {
        padding: 24px;
        margin: 16px;
    }
    .auth-card .auth-title {
        font-size: 1.4rem;
    }
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }