:root {
    --primary: #6366f1; --secondary: #a855f7; --accent: #f59e0b;
    --success: #10b981; --danger: #ef4444; --bg: #0b0f1a;
    --card-bg: rgba(30, 41, 59, 0.4); --sidebar-bg: rgba(15, 23, 42, 0.8);
    --text-main: #f8fafc; --text-dim: #94a3b8; --glass-border: rgba(255, 255, 255, 0.1);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Outfit', sans-serif; background: radial-gradient(circle at 100% 100%, #1e1b4b 0%, #0b0f1a 50%); color: var(--text-main); display: flex; min-height: 100vh; overflow-x: hidden; }

.sidebar { width: 260px; background: var(--sidebar-bg); backdrop-filter: blur(20px); border-right: 1px solid var(--glass-border); display: flex; flex-direction: column; height: 100vh; position: fixed; z-index: 100; }
.logo-area { padding: 2rem; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--glass-border); }
.logo-icon { width: 35px; height: 35px; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: 8px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); }
.nav-list { list-style: none; padding: 1.5rem 0; margin: 0; flex-grow: 1; overflow-y: auto; }
.nav-item { padding: 0.75rem 2rem; display: flex; align-items: center; gap: 15px; color: var(--text-dim); cursor: pointer; border-left: 3px solid transparent; font-size: 0.95rem; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease; will-change: transform; }
.nav-item:hover, .nav-item.active { background: rgba(99, 102, 241, 0.1); color: var(--text-main); border-left-color: var(--primary); }
.nav-item:active { transform: scale(0.98); }

/* Main Layout & Responsiveness */
.main-content { 
    margin-left: 260px; 
    flex-grow: 1; 
    padding: 2rem; 
    width: calc(100% - 260px); 
    display: flex; 
    flex-direction: column; 
    min-width: 0; 
}

.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2.5rem; }
.search-bar { background: var(--card-bg); border: 1px solid var(--glass-border); border-radius: 12px; padding: 0.7rem 1.2rem; display: flex; align-items: center; gap: 12px; width: 400px; }
.search-bar input { background: transparent; border: none; color: var(--text-main); outline: none; width: 100%; font-size: 0.9rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin-bottom: 2.5rem; }
.stat-card { background: var(--card-bg); padding: 1.8rem; border-radius: 1.2rem; border: 1px solid var(--glass-border); backdrop-filter: blur(10px); position: relative; overflow: hidden; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.stat-value { font-size: 2rem; font-weight: 600; margin-top: 5px; }
.stat-label { color: var(--text-dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; }

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 14px;
}

.data-table-container { background: var(--card-bg); border: 1px solid var(--glass-border); border-radius: 14px; overflow: hidden; margin-bottom: 2.5rem; backdrop-filter: blur(10px); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 1.2rem; background: rgba(255,255,255,0.03); color: var(--text-dim); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; border-bottom: 1px solid var(--glass-border); }
.data-table td { padding: 1.2rem; border-bottom: 1px solid var(--glass-border); font-size: 0.95rem; }
.status-pill { padding: 5px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.status-online { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-offline { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}
.card-body { padding: 1.5rem; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); z-index: 2000; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 2rem 0; opacity: 0; transition: opacity 0.2s ease; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content { background: #131722; width: 500px; padding: 2.5rem; border-radius: 20px; border: 1px solid var(--glass-border); transform: scale(0.95); transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-overlay.active .modal-content { transform: scale(1); }

.action-btn { background: var(--primary); color: white; border: none; padding: 12px 24px; border-radius: 10px; cursor: pointer; font-weight: 500; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; justify-content: center; transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease; will-change: transform; }
.action-btn:hover { background: #4f46e5; transform: translateY(-1px); box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3); }
.action-btn:active { transform: scale(0.97) translateY(0); }
.action-btn:disabled { opacity: 0.6; cursor: wait; }

.page-view { display: none; }
.page-view.active { display: block; }

.inner-tab { padding: 10px 20px; cursor: pointer; color: var(--text-dim); border-bottom: 2px solid transparent; font-size: 0.95rem; font-weight: 500; transition: color 0.15s ease, border-color 0.15s ease, transform 0.05s ease; will-change: transform; }
.inner-tab:hover { color: var(--text-main); }
.inner-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.inner-tab:active { transform: scale(0.97); }

.net-tab-content, .cust-tab-content, .tab-content { display: none; }
.net-tab-content.active, .cust-tab-content.active, .tab-content.active { display: block; }

input, select, textarea { width: 100%; padding: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); border-radius: 10px; color: white; margin-top: 8px; outline: none; font-size: 0.9rem; transition: border-color 0.15s ease, background-color 0.15s ease; }
input:focus { border-color: var(--primary); background: rgba(255,255,255,0.06); }
label { font-size: 0.8rem; color: var(--text-dim); margin-top: 10px; display: block; text-transform: uppercase; letter-spacing: 0.5px; }

.quick-btn { background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); padding: 1.5rem; border-radius: 15px; text-align: center; cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease; will-change: transform; }
.quick-btn:hover { background: rgba(99, 102, 241, 0.1); border-color: var(--primary); transform: translateY(-2px); }
.quick-btn:active { transform: scale(0.97); }
.quick-btn i { font-size: 1.5rem; color: var(--primary); margin-bottom: 10px; display: block; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--secondary); }


.sidebar-mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 90;
    backdrop-filter: blur(3px);
}

/* Responsive Design */
@media (max-width: 900px) {
    body { overflow-x: hidden; }
    .sidebar { transform: translateX(-100%); box-shadow: 2px 0 15px rgba(0,0,0,0.5); width: 280px; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; padding: 1rem; }
    .header { flex-direction: column; gap: 1rem; align-items: stretch; margin-bottom: 1.5rem; }
    #mobile-menu-btn { display: flex !important; align-items: center; justify-content: center; width: 45px; height: 45px; }
    .search-bar { width: 100%; order: 2; }
    .stats-grid { grid-template-columns: 1fr; }
    .modal-content { width: 95%; padding: 1.5rem; margin: 10px; }
    
    .logo-area { padding: 1.5rem; }
    .nav-item { padding: 1rem 1.5rem; }
}

@media (min-width: 901px) {
    .sidebar { transform: translateX(0) !important; }
}


/* MARAIS WIRELESS PREMIUM DARK GLASSMORPHISM THEME */
:root {
    --primary-bg: #09090b;
    --secondary-bg: #18181b;
    --accent-color: #0ea5e9;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}

body {
    background: linear-gradient(135deg, var(--primary-bg), #0f172a) !important;
    color: var(--text-main) !important;
    font-family: 'Inter', 'Segoe UI', sans-serif !important;
}

/* Glassmorphism Cards */
.card, .panel, .modal-content, .bg-white, .sidebar, .data-table-container, .stat-card {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5) !important;
    color: var(--text-main) !important;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6, .text-dark {
    color: #ffffff !important;
    font-weight: 600 !important;
}

p, span, td, th, label {
    color: var(--text-muted) !important;
}

/* Buttons */
.btn-primary, .action-btn {
    background: linear-gradient(90deg, #0284c7, #0ea5e9) !important;
    border: none !important;
    border-radius: 8px !important;
    color: white !important;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.4) !important;
    transition: all 0.3s ease !important;
}
.btn-primary:hover, .action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(14, 165, 233, 0.6) !important;
}

/* Inputs & Tables */
input, select, textarea, .form-control {
    background: rgba(0,0,0,0.2) !important;
    border: 1px solid var(--glass-border) !important;
    color: white !important;
    border-radius: 8px !important;
}
input:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.3) !important;
}
table th {
    background: rgba(255,255,255,0.05) !important;
    border-bottom: 1px solid var(--glass-border) !important;
}
table td {
    border-bottom: 1px solid rgba(255,255,255,0.02) !important;
}

/* Navbar / Topbar */
.navbar, .topbar, .header {
    background: rgba(9, 9, 11, 0.8) !important;
    backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    border-radius: 16px;
    padding: 1rem 1.5rem !important;
}


.map-label { 
    background: rgba(19, 23, 34, 0.9); 
    border: 1px solid var(--primary); 
    color: white; 
    border-radius: 6px; 
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5); 
}
.map-label::before { 
    border-right-color: var(--primary) !important; 
}
.leaflet-tooltip-left.map-label::before {
    border-left-color: var(--primary) !important;
}
.leaflet-tooltip-top.map-label::before {
    border-top-color: var(--primary) !important;
}

/* ========================================= */
/* LIGHT THEME OVERRIDES                     */
/* ========================================= */
[data-theme="light"] body {
    background: #f4f6f9 !important;
    color: #333333 !important;
}
[data-theme="light"] .card, 
[data-theme="light"] .panel, 
[data-theme="light"] .modal-content, 
[data-theme="light"] .bg-white, 
[data-theme="light"] .sidebar, 
[data-theme="light"] .data-table-container, 
[data-theme="light"] .stat-card {
    background: #ffffff !important;
    border-color: rgba(0,0,0,0.1) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
    color: #333333 !important;
}
[data-theme="light"] input, 
[data-theme="light"] select, 
[data-theme="light"] textarea, 
[data-theme="light"] .form-control,
[data-theme="light"] .search-bar {
    background: #ffffff !important;
    color: #333333 !important;
    border-color: rgba(0,0,0,0.2) !important;
}
[data-theme="light"] input::placeholder {
    color: #999999 !important;
}
[data-theme="light"] table th {
    background: #f8f9fa !important;
    color: #555555 !important;
    border-bottom: 2px solid rgba(0,0,0,0.1) !important;
}
[data-theme="light"] table td {
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
    color: #444444 !important;
}
[data-theme="light"] .navbar, 
[data-theme="light"] .topbar, 
[data-theme="light"] .header {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0,0,0,0.1) !important;
}
[data-theme="light"] .nav-item {
    color: #555555 !important;
}
[data-theme="light"] .nav-item:hover, 
[data-theme="light"] .nav-item.active {
    background: rgba(0,0,0,0.05) !important;
    color: var(--primary) !important;
}
[data-theme="light"] .stat-label,
[data-theme="light"] .text-dim,
[data-theme="light"] label {
    color: #666666 !important;
}
[data-theme="light"] .map-label {
    background: #ffffff !important;
    color: #333333 !important;
    border: 1px solid rgba(0,0,0,0.2) !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
}


[data-theme="light"] h1, [data-theme="light"] h2, [data-theme="light"] h3, [data-theme="light"] h4, [data-theme="light"] h5, [data-theme="light"] h6 { color: #333333 !important; }

/* Script & Batch Automation Studio */
.auto-device-card:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
}
.auto-mode-btn {
    transition: all 0.2s ease;
}
.auto-mode-btn.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}
#auto-script-editor:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}


