/* ============================================================
   RJ45 Admin — Dashboard styles
   ============================================================ */

/* Login gate */
.login-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-deep) 100%);
  position: relative;
  overflow: hidden;
}
.login-gate::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 400px at 10% 20%, rgba(45, 212, 168, 0.2), transparent 60%),
    radial-gradient(500px 300px at 90% 80%, rgba(245, 197, 66, 0.15), transparent 60%);
}
.login-card {
  background: var(--bg);
  border-radius: var(--r-xl);
  padding: var(--s-8);
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}
.login-card h2 {
  font-size: var(--fs-xl);
  margin-bottom: var(--s-2);
}

/* Shell */
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg-soft);
}
.admin-sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: var(--s-6) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-logo {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-3) var(--s-5);
  border-bottom: 1px dashed var(--border);
  margin-bottom: var(--s-3);
}
.admin-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 7px;
  background: var(--brand-yellow);
  color: var(--brand-navy);
  border-radius: var(--r-pill);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.admin-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-sm);
}
.admin-nav-section {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  padding: var(--s-4) var(--s-3) var(--s-1);
  text-transform: uppercase;
}
.admin-nav a {
  padding: 10px 12px;
  color: var(--text);
  border-radius: var(--r-sm);
  font-weight: 500;
  transition: all var(--dur-1) var(--ease);
}
.admin-nav a:hover { background: var(--surface-2); color: var(--brand-mint-deep); }
[data-theme="dark"] .admin-nav a:hover { color: var(--brand-mint); }
.admin-nav a.active {
  background: var(--brand-navy);
  color: var(--brand-white);
}
.admin-foot {
  padding-top: var(--s-4);
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.admin-main {
  min-width: 0;
}
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: var(--s-5) var(--s-7);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  backdrop-filter: blur(8px);
}
[data-theme="dark"] .admin-topbar { background: rgba(7, 13, 28, 0.85); }
.admin-topbar-right { display: flex; align-items: center; gap: var(--s-3); }
.admin-content {
  padding: var(--s-7);
}

/* Responsive collapse */
@media (max-width: 960px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: relative;
    height: auto;
    overflow: visible;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: var(--s-1);
    padding: var(--s-3) var(--s-4);
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .admin-logo { padding: 0; margin-bottom: 0; border: 0; flex-shrink: 0; }
  .admin-nav { flex-direction: row; flex-shrink: 0; }
  .admin-nav-section { display: none; }
  .admin-nav a { white-space: nowrap; }
  .admin-foot { flex-direction: row; padding: 0; border: 0; flex-shrink: 0; }
}

/* ============================================================
   Stat cards + Table
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-bottom: var(--s-7);
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-5);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-yellow), var(--brand-mint));
}
.stat-card .label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.stat-card .num {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-card .sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 8px;
}

/* Panels */
.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.panel-head {
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.panel-head h3 { font-size: var(--fs-md); margin: 0; }
.panel-body { padding: var(--s-4) var(--s-6); }
.panel-empty {
  padding: var(--s-8);
  text-align: center;
  color: var(--text-muted);
}

.two-col {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--s-5);
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.admin-table th, .admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--divider);
}
.admin-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 500;
  background: var(--bg-soft);
}
[data-theme="dark"] .admin-table th { background: rgba(0,0,0,0.2); }
.admin-table tbody tr:hover { background: var(--bg-soft); }
[data-theme="dark"] .admin-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.admin-table .thumb {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.admin-table .thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-sm); }
.admin-table .thumb svg { width: 24px; height: 24px; color: var(--brand-navy); opacity: 0.6; }
.admin-table .actions { display: flex; gap: 4px; justify-content: flex-end; }

/* Status badges */
.status {
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status-new { background: #dbeafe; color: #1e40af; }
.status-processing { background: #fef3c7; color: #92400e; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-archived { background: #e5e7eb; color: #374151; }
[data-theme="dark"] .status-new { background: rgba(30, 64, 175, 0.2); color: #93c5fd; }
[data-theme="dark"] .status-processing { background: rgba(146, 64, 14, 0.2); color: #fcd34d; }
[data-theme="dark"] .status-completed { background: rgba(6, 95, 70, 0.2); color: #6ee7b7; }
[data-theme="dark"] .status-archived { background: rgba(55, 65, 81, 0.3); color: #d1d5db; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
  flex-wrap: wrap;
}
.page-head h2 { margin: 0; font-size: var(--fs-xl); }
.page-head p { margin: 4px 0 0; color: var(--text-muted); font-size: var(--fs-sm); }

/* Tile cards for grid views (projects, team, testimonials, services) */
.admin-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.admin-tile-img {
  aspect-ratio: 16 / 10;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.admin-tile-img img { width: 100%; height: 100%; object-fit: cover; }
.admin-tile-img svg { width: 56px; height: 56px; color: var(--brand-navy); opacity: 0.5; }
[data-theme="dark"] .admin-tile-img svg { color: var(--brand-mint); }
.admin-tile-body { padding: var(--s-4); flex: 1; display: flex; flex-direction: column; gap: 6px; }
.admin-tile-title { font-weight: 700; font-size: var(--fs-sm); margin: 0; color: var(--text); }
.admin-tile-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.admin-tile-actions {
  display: flex;
  gap: 4px;
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
[data-theme="dark"] .admin-tile-actions { background: rgba(0,0,0,0.2); }

.admin-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}
@media (max-width: 1000px) { .admin-tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .admin-tile-grid { grid-template-columns: 1fr; } }

/* Image drop */
.image-drop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: var(--s-6);
  text-align: center;
  cursor: pointer;
  background: var(--bg-soft);
  transition: all var(--dur-1) var(--ease);
  position: relative;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
}
.image-drop:hover { border-color: var(--brand-mint); background: var(--bg-mint); }
.image-drop input[type=file] { display: none; }
.image-drop.has-image {
  padding: 0;
  background: var(--bg);
  border-style: solid;
  min-height: auto;
}
.image-drop img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--r-md);
}
.image-drop-actions {
  padding: var(--s-3);
  display: flex;
  gap: var(--s-2);
  justify-content: center;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

/* Spec/feature list editor */
.kv-editor {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.kv-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--s-2);
}
.kv-row-single {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-2);
}
.kv-row button, .kv-row-single button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger);
  border-radius: var(--r-sm);
  cursor: pointer;
  width: 38px;
}

/* Data page */
.data-section {
  margin-bottom: var(--s-7);
  padding: var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
}
.data-section h4 { margin: 0 0 var(--s-2); font-size: var(--fs-md); }
.data-section p { margin: 0 0 var(--s-3); font-size: var(--fs-sm); color: var(--text-muted); }

/* Helper classes */
.hidden { display: none !important; }
.flex-end { display: flex; justify-content: flex-end; gap: var(--s-2); }
