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

:root {
    /* Ultra-Premium Linear/Vercel Style Color Palette */
    --bg-base: #000000;
    --bg-surface: #0a0a0a;
    --bg-surface-glass: #0a0a0a; /* No glass, solid colors */
    --bg-secondary: #111111;
    --bg-elevated: #161616;
    
    --primary-color: #ededed;
    --primary-hover: #ffffff;
    --primary-glow: rgba(255, 255, 255, 0.05);
    
    --accent: #3291ff;
    --accent-hover: #1e80f0;
    --accent-glow: rgba(50, 145, 255, 0.2);
    
    --text-color: #ededed;
    --text-muted: #888888;
    --border-color: rgba(255, 255, 255, 0.14);
    --border-light: rgba(255, 255, 255, 0.08);
    
    --danger: #e5484d;
    --danger-hover: #ff4d4f;
    --success: #30a46c;
    --warning: #f7ce00;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Effects */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --transition: all 0.15s ease-out;
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    font-size: 14px;
}

h1, h2, h3, h4, h5 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-color);
    letter-spacing: -0.03em;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* Layout Utilities */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    height: 64px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0.75rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition);
    gap: 0.75rem;
}

.nav-item i {
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
    opacity: 0.7;
}

.nav-item:hover {
    background: var(--bg-elevated);
    color: var(--text-color);
}

.nav-item:hover i {
    opacity: 1;
}

.nav-item.active {
    background: var(--bg-secondary);
    color: var(--text-color);
}

.nav-item.active i {
    color: var(--text-color);
    opacity: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 3rem 4rem;
    max-width: 1400px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.page-header h1 {
    font-size: 2rem;
    letter-spacing: -0.04em;
    margin-bottom: 0.25rem;
}

/* Cards & Panels */
.glass-panel, .card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    border-color: var(--border-color);
}

.card-hover:hover {
    border-color: var(--border-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--text-color);
    color: var(--bg-base);
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn:hover {
    background: #d4d4d4;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-light);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    border-color: var(--border-color);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--border-light);
    box-shadow: none;
}

.btn-danger:hover {
    background: rgba(229, 72, 77, 0.1);
    border-color: rgba(229, 72, 77, 0.4);
}

.btn i {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control, select, input[type="text"], input[type="password"], input[type="email"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-color);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus, select:focus, input:focus {
    outline: none;
    border-color: var(--text-muted);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
    background: var(--bg-elevated);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}

.badge-success {
    background: rgba(48, 164, 108, 0.15);
    color: var(--success);
    border-color: rgba(48, 164, 108, 0.3);
}

.badge-warning {
    background: rgba(247, 206, 0, 0.15);
    color: var(--warning);
    border-color: rgba(247, 206, 0, 0.3);
}

/* Grid Layouts */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Utility Classes */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Login specific overrides */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-surface);
    padding: 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

.login-card h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

/* Additional UI for tracking/audio/files */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}
.status-badge.online { background: rgba(48, 164, 108, 0.1); color: var(--success); border-color: rgba(48, 164, 108, 0.2); }
.status-badge.offline { background: rgba(229, 72, 77, 0.1); color: var(--danger); border-color: rgba(229, 72, 77, 0.2); }

/* Fix missing list-group styles from devices.php */
.list-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.list-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
}
.list-item-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* -----------------------------------------
   RESPONSIVE DESIGN (Mobile First / Tablet)
   ----------------------------------------- */

/* Mobile Menu Button */
.mobile-logout-btn { display: none; }
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 0.5rem;
    cursor: pointer;
    margin-right: 1rem;
}

.mobile-menu-btn i {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.mobile-header-bar {
    display: none;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 90;
}

.mobile-header-bar h2 {
    margin: 0;
    font-size: 1.2rem;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 95;
    opacity: 0;
    transition: opacity 0.3s;
}


@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* Transform Sidebar into Top Nav */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        flex-direction: column;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        background: var(--bg-surface);
        z-index: 100;
        box-shadow: var(--shadow-sm);
        padding-bottom: 0.5rem;
    }

    .sidebar-header {
        height: 60px;
        padding: 0 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: none;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding: 0 1rem;
        gap: 0.75rem;
        scrollbar-width: none; /* Firefox */
        align-items: center;
    }
    
    .sidebar-nav::-webkit-scrollbar {
        display: none; /* Safari and Chrome */
    }

    .nav-item {
        white-space: nowrap;
        margin-bottom: 0;
        padding: 0.5rem 1rem;
        background: var(--bg-elevated);
        border: 1px solid var(--border-light);
        border-radius: 20px; /* Pill shape */
        font-size: 0.8rem;
    }
    
    .nav-item.active {
        background: var(--accent);
        color: white;
        border-color: var(--accent);
    }
    
    .nav-item.active i {
        color: white;
    }

    /* Hide section labels and logout container in sidebar nav */
    .mobile-logout-btn { display: block !important; }
    .sidebar-nav > div {
        display: none !important;
    }
    
    .sidebar > div:last-child {
        display: none;
    }
    
    /* Main Content adjustment to clear the fixed header (60px header + 50px pills = ~110px) */
    .main-content {
        margin-left: 0;
        margin-top: 120px; 
        padding: 1.5rem 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .grid-cards {
        grid-template-columns: 1fr;
    }
    
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .btn-mobile-full {
        width: 100%;
        justify-content: center;
    }
    
    #map {
        height: 300px !important;
    }
}


