/* ============================================================
   TELAREX MGMT — Dashboard Stylesheet
   Brand: Black #0A0A0A | Blue #2B35F5 | White #FFFFFF
   ============================================================ */

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

:root {
  --blue:       #2B35F5;
  --blue-dark:  #1E28D4;
  --blue-dim:   rgba(43,53,245,0.12);
  --black:      #0A0A0A;
  --dark:       #101012;
  --dark-2:     #18181C;
  --dark-3:     #222228;
  --white:      #FFFFFF;
  --gray:       #888898;
  --gray-light: #BBBBCC;
  --border:     rgba(255,255,255,0.07);
  --green:      #22c55e;
  --red:        #ef4444;
  --yellow:     #f59e0b;
  --font:       'Inter', -apple-system, sans-serif;
  --nav-h:      60px;
  --radius:     6px;
  --sidebar-w:  240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--black);
  color: var(--white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font); }

/* ── Auth / Login ─────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  padding: 2rem;
}
.auth-card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}
.auth-logo img { height: 32px; }
.auth-logo-text {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.auth-logo-text span { color: var(--blue); }
.auth-card h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.auth-card p {
  color: var(--gray);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-light);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.form-group input {
  width: 100%;
  background: var(--dark-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s;
  outline: none;
}
.form-group input:focus { border-color: var(--blue); }
.form-group input::placeholder { color: var(--gray); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--blue); color: var(--white); width: 100%; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.8rem; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--gray-light);
}
.btn-outline:hover { border-color: rgba(255,255,255,0.25); color: var(--white); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.auth-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  display: none;
}

/* ── App Shell ────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img { height: 28px; }
.sidebar-logo-text { font-size: 1rem; font-weight: 800; letter-spacing: -0.03em; }
.sidebar-logo-text span { color: var(--blue); }
.sidebar-section {
  padding: 1.25rem 0.75rem 0.5rem;
}
.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray);
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-light);
  transition: all 0.15s;
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.sidebar-nav a.active { background: var(--blue-dim); color: var(--blue); }
.sidebar-nav svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.sidebar-nav a.active svg { opacity: 1; }
.sidebar-footer {
  margin-top: auto;
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--gray);
  padding: 0.4rem 0.5rem;
}
.sidebar-user strong { color: var(--gray-light); font-weight: 600; }

/* Main content */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--nav-h);
  background: rgba(10,10,10,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.page { padding: 2rem 1.75rem; flex: 1; }

/* ── Stats Row ────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}
.stat-card__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  margin-bottom: 0.5rem;
}
.stat-card__value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.stat-card__value.green { color: var(--green); }
.stat-card__value.red { color: var(--red); }
.stat-card__value.blue { color: var(--blue); }

/* ── Table ────────────────────────────────────────────────── */
.card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 0.9rem; font-weight: 600; }
.card-header-actions { display: flex; gap: 0.5rem; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray);
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.9rem 1.25rem;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.data-table a { color: var(--blue); }
.data-table a:hover { text-decoration: underline; }

/* ── Status Badge ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-online  { background: rgba(34,197,94,0.12);  color: var(--green);  }
.badge-online::before  { background: var(--green);  box-shadow: 0 0 4px var(--green); }
.badge-offline { background: rgba(239,68,68,0.12);  color: var(--red);    }
.badge-offline::before { background: var(--red); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--yellow); }
.badge-warning::before { background: var(--yellow); }

/* ── WAN Link Row ─────────────────────────────────────────── */
.wan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.wan-card {
  background: var(--dark-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}
.wan-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.wan-card__name { font-size: 0.85rem; font-weight: 600; }
.wan-card__detail { font-size: 0.8rem; color: var(--gray); margin-top: 0.25rem; }
.signal-bar { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.signal-bar span {
  width: 4px;
  background: var(--dark);
  border-radius: 2px;
  transition: background 0.3s;
}
.signal-bar span.active { background: var(--green); }
.signal-bar span:nth-child(1) { height: 4px; }
.signal-bar span:nth-child(2) { height: 7px; }
.signal-bar span:nth-child(3) { height: 10px; }
.signal-bar span:nth-child(4) { height: 13px; }
.signal-bar span:nth-child(5) { height: 16px; }

/* ── Device Detail ────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.875rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row__label { color: var(--gray); }
.detail-row__value { font-weight: 500; text-align: right; }

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--blue); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--gray); }

/* ── Empty / Loading states ───────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray);
}
.empty-state svg { margin: 0 auto 1rem; opacity: 0.3; }
.empty-state p { font-size: 0.875rem; }
.loading-row td {
  padding: 2rem !important;
  text-align: center;
  color: var(--gray);
  font-size: 0.875rem;
}
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .detail-grid { grid-template-columns: 1fr; }
}
