:root {
  --bg-dark: #0d1117;
  --bg-card: #161b22;
  --bg-sidebar: #0d1117;
  --bg-header: #161b22;
  --border-color: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-blue: #1f6feb;
  --accent-green: #238636;
  --accent-red: #da3633;
  --accent-yellow: #d29922;
  --accent-orange: #db6d28;
  --sidebar-width: 240px;
  --header-height: 60px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-size: 13px;
  overflow-x: hidden;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #1f6feb, #388bfd);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; font-weight: 700;
}
.sidebar-brand .brand-name { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.sidebar-brand .brand-sub { font-size: 10px; color: var(--text-muted); }

.sidebar-nav { padding: 8px 0; flex: 1; }
.nav-section { padding: 12px 16px 4px; font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }

.nav-item { display: block; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  position: relative;
}
.nav-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.nav-link.active { color: #58a6ff; background: rgba(31,111,235,0.1); border-left-color: #1f6feb; }
.nav-link i { width: 18px; text-align: center; font-size: 14px; }
.nav-link .badge-count {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center;
}

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border-color); font-size: 11px; color: var(--text-muted); }
.sidebar-footer .version { font-weight: 600; color: var(--accent-green); }

/* ---- HEADER ---- */
.main-header {
  position: fixed;
  left: var(--sidebar-width); right: 0; top: 0;
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; padding: 0 20px; gap: 16px;
  z-index: 999;
}
.header-search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px; padding: 6px 12px; gap: 8px;
}
.header-search input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 13px; flex: 1;
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search i { color: var(--text-muted); }

.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color); color: var(--text-secondary);
  cursor: pointer; text-decoration: none; transition: all 0.15s; position: relative;
}
.header-icon-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.1); }
.header-icon-btn .notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; background: var(--accent-red); border-radius: 50%;
}

.user-menu { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #1f6feb, #58a6ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-info .user-role { font-size: 10px; color: var(--text-muted); }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 20px;
  min-height: calc(100vh - var(--header-height));
}

.page-title { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  background: transparent;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 18px; }

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px; padding: 14px 16px;
  position: relative; overflow: hidden;
}
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 10px;
}
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-card .stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.stat-card .stat-change { font-size: 11px; margin-top: 4px; }
.stat-card .stat-change.up { color: var(--accent-green); }
.stat-card .stat-change.down { color: var(--accent-red); }
.stat-card .mini-chart { margin-top: 10px; opacity: 0.7; }

/* ---- TABLES ---- */
.table-dark-custom { width: 100%; border-collapse: collapse; }
.table-dark-custom th {
  background: rgba(255,255,255,0.03); padding: 10px 14px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color); white-space: nowrap;
}
.table-dark-custom td {
  padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-primary); font-size: 12px; vertical-align: middle;
}
.table-dark-custom tr:last-child td { border-bottom: none; }
.table-dark-custom tr:hover td { background: rgba(255,255,255,0.02); }
.table-dark-custom a { color: #58a6ff; text-decoration: none; }
.table-dark-custom a:hover { text-decoration: underline; }

/* ---- BADGES ---- */
.badge-status {
  padding: 3px 8px; border-radius: 4px; font-size: 10px; font-weight: 600;
}
.badge-status.badge-success { background: rgba(35,134,54,0.2); color: #3fb950; }
.badge-status.badge-danger { background: rgba(218,54,51,0.2); color: #f85149; }
.badge-status.badge-warning { background: rgba(210,153,34,0.2); color: #d29922; }
.badge-status.badge-info { background: rgba(31,111,235,0.2); color: #58a6ff; }
.badge-status.badge-secondary { background: rgba(139,148,158,0.2); color: #8b949e; }

/* ---- BUTTONS ---- */
.btn { border-radius: 6px; font-size: 13px; font-weight: 500; padding: 7px 14px; border: none; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #388bfd; color: #fff; }
.btn-success { background: var(--accent-green); color: #fff; }
.btn-success:hover { background: #2ea043; color: #fff; }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #f85149; color: #fff; }
.btn-warning { background: var(--accent-yellow); color: #fff; }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-outline:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; }

/* ---- FORMS ---- */
.form-control, .form-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px; color: var(--text-primary); font-size: 13px; padding: 8px 12px;
  width: 100%; transition: border-color 0.15s; outline: none;
}
.form-control:focus, .form-select:focus { border-color: var(--accent-blue); background: rgba(255,255,255,0.07); }
.form-control::placeholder { color: var(--text-muted); }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.form-select option { background: var(--bg-card); color: var(--text-primary); }
.input-group { display: flex; }
.input-group .form-control { border-radius: 6px 0 0 6px; }
.input-group .btn { border-radius: 0 6px 6px 0; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: rgba(35,134,54,0.15); border-color: rgba(35,134,54,0.3); color: #3fb950; }
.alert-danger { background: rgba(218,54,51,0.15); border-color: rgba(218,54,51,0.3); color: #f85149; }
.alert-warning { background: rgba(210,153,34,0.15); border-color: rgba(210,153,34,0.3); color: #d29922; }
.alert-info { background: rgba(31,111,235,0.15); border-color: rgba(31,111,235,0.3); color: #58a6ff; }

/* ---- MODAL ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 2000; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; }

/* ---- ALARM COLORS ---- */
.alarm-critical { border-left: 3px solid var(--accent-red); }
.alarm-major { border-left: 3px solid var(--accent-orange); }
.alarm-minor { border-left: 3px solid var(--accent-blue); }
.alarm-warning { border-left: 3px solid var(--accent-yellow); }

/* ---- SIGNAL STRENGTH ---- */
.signal-good { color: #3fb950; }
.signal-ok { color: #d29922; }
.signal-bad { color: #f85149; }

/* ---- PROGRESS ---- */
.progress { background: rgba(255,255,255,0.1); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; background: var(--accent-blue); transition: width 0.3s; }
.progress-bar.bg-success { background: var(--accent-green); }
.progress-bar.bg-danger { background: var(--accent-red); }
.progress-bar.bg-warning { background: var(--accent-yellow); }

/* ---- BREADCRUMB ---- */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb .separator { color: var(--text-muted); }

/* ---- STATUS INDICATOR ---- */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.online { background: #3fb950; box-shadow: 0 0 6px #3fb950; }
.status-dot.offline { background: #f85149; }
.status-dot.los { background: #d29922; box-shadow: 0 0 6px #d29922; animation: blink 1.2s infinite; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ---- NETWORK MAP ---- */
#networkMap { width: 100%; height: 450px; border-radius: 8px; overflow: hidden; }
.leaflet-container { background: #0d1117; }

/* ---- SEARCH BAR ---- */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border-color); }

/* ---- DROPDOWN ---- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px;
  min-width: 180px; z-index: 9999; display: none; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.dropdown-menu.show { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; color: var(--text-secondary); cursor: pointer; font-size: 13px; text-decoration: none; transition: all 0.1s; }
.dropdown-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.dropdown-divider { border-top: 1px solid var(--border-color); margin: 4px 0; }

/* ---- TABS ---- */
.nav-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; }
.nav-tab { padding: 10px 18px; font-size: 13px; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; text-decoration: none; transition: all 0.15s; }
.nav-tab:hover { color: var(--text-primary); }
.nav-tab.active { color: #58a6ff; border-bottom-color: #1f6feb; }

/* ---- CHART CONTAINER ---- */
.chart-container { position: relative; }

/* ---- VENDOR COLORS ---- */
.vendor-huawei { color: #e2231a; }
.vendor-zte { color: #1c6fb5; }
.vendor-fiberhome { color: #00a651; }
.vendor-nokia { color: #005aff; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content, .main-header { margin-left: 0; left: 0; }
}

/* ---- UTILITIES ---- */
.text-success { color: #3fb950 !important; }
.text-danger { color: #f85149 !important; }
.text-warning { color: #d29922 !important; }
.text-info { color: #58a6ff !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-14 { font-size: 14px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.p-0 { padding: 0; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.px-3 { padding-left: 16px; padding-right: 16px; }

/* Grid */
.row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.row > * { padding: 0 8px; }
.col-2 { width: 16.666%; }
.col-3 { width: 25%; }
.col-4 { width: 33.333%; }
.col-5 { width: 41.666%; }
.col-6 { width: 50%; }
.col-7 { width: 58.333%; }
.col-8 { width: 66.666%; }
.col-9 { width: 75%; }
.col-12 { width: 100%; }
.mb-grid { margin-bottom: 16px; }

/* ---- LOGIN PAGE ---- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 30% 20%, rgba(31,111,235,0.15) 0%, transparent 60%), var(--bg-dark); }
.login-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { width: 56px; height: 56px; background: linear-gradient(135deg, #1f6feb, #388bfd); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; font-weight: 700; margin: 0 auto 12px; }
.login-logo h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.login-logo p { font-size: 12px; color: var(--text-muted); }

/* ---- ADDITIONAL UTILITIES ---- */
.fs-13 { font-size: 13px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }
.fs-22 { font-size: 22px; }
.gap-1 { gap: 4px; }
.gap-10 { gap: 10px; }
.ms-2 { margin-left: 8px; }
.ms-auto { margin-left: auto; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.btn-close-modal { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 0 4px; }
.btn-close-modal:hover { color: var(--text-primary); }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border-color); background: transparent; }
.pagination { display: flex; list-style: none; gap: 4px; flex-wrap: wrap; }
.page-item .page-link { display: flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border-color); background: transparent; color: var(--text-muted); text-decoration: none; font-size: 12px; transition: all 0.15s; }
.page-item.active .page-link { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.page-item .page-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.mb-grid { margin-bottom: 16px; }
