/**
 * FABLE DIGITAL SOLUTIONS — EXECUTIVE ADMIN CONSOLE STYLES
 * Luxury Obsidian & Monochromatic Aesthetic with Violet Luminescence
 */

:root {
  --admin-bg: #06080e;
  --admin-surface: #0a0e1a;
  --admin-card: rgba(15, 20, 34, 0.85);
  --admin-border: rgba(255, 255, 255, 0.08);
  --admin-border-hover: rgba(168, 85, 247, 0.35);
  --admin-primary: #a855f7;
  --admin-primary-glow: rgba(168, 85, 247, 0.25);
  --admin-text-main: #f8fafc;
  --admin-text-muted: #94a3b8;
  --admin-text-dim: #64748b;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-info: #38bdf8;
  --admin-danger: #ef4444;
}

[data-theme="light"] {
  --admin-bg: #f8fafc;
  --admin-surface: #ffffff;
  --admin-card: #ffffff;
  --admin-border: rgba(0, 0, 0, 0.09);
  --admin-border-hover: rgba(124, 58, 237, 0.4);
  --admin-primary: #7c3aed;
  --admin-primary-glow: rgba(124, 58, 237, 0.15);
  --admin-text-main: #090d16;
  --admin-text-muted: #475569;
  --admin-text-dim: #64748b;
}

[data-theme="light"] .admin-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .admin-brand-title {
  color: #090d16;
}

[data-theme="light"] .admin-search-input,
[data-theme="light"] .admin-filter-select {
  background: #f8fafc;
  color: #090d16;
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .admin-table {
  color: #1e293b;
}

[data-theme="light"] .admin-table th {
  background: #f1f5f9;
  color: #090d16;
}

[data-theme="light"] .admin-table td {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .admin-table tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .metric-tile {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.09);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .admin-card-container {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.09);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04);
}

body.admin-body {
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  font-family: var(--font-body, system-ui, -apple-system, sans-serif);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   1. Executive Header & Command Bar
   -------------------------------------------------------------------------- */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 8, 14, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--admin-border);
  padding: 0.85rem 2rem;
}

.admin-header-inner {
  max-width: 1440px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.admin-brand-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.admin-brand-link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.admin-brand-title {
  font-family: var(--font-display, inherit);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fff;
}

.admin-brand-sub {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  font-family: var(--font-mono, monospace);
  color: var(--admin-primary);
  text-transform: uppercase;
}

.admin-console-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: #c084fc;
}

.admin-telemetry-cluster {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.telemetry-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  color: var(--admin-text-muted);
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--admin-success);
  box-shadow: 0 0 8px var(--admin-success);
  animation: pulse-dot 2s infinite ease-in-out;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid var(--admin-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--admin-text-main);
}

.btn-admin:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-1px);
}

.btn-admin-primary {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  border-color: rgba(168, 85, 247, 0.5);
  color: #fff;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-admin-primary:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  box-shadow: 0 6px 20px rgba(147, 51, 234, 0.45);
  border-color: rgba(192, 132, 252, 0.8);
}

/* --------------------------------------------------------------------------
   2. Main Container & KPI Cards
   -------------------------------------------------------------------------- */
.admin-container {
  max-width: 1440px;
  margin-inline: auto;
  padding: 2.5rem 2rem 5rem;
  width: 100%;
  box-sizing: border-box;
  flex: 1;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.kpi-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.6), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kpi-card:hover {
  border-color: var(--admin-border-hover);
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 30px var(--admin-primary-glow);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.kpi-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--admin-text-muted);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-primary);
}

.kpi-value {
  font-family: var(--font-display, inherit);
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 0.45rem;
}

.kpi-footer {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--admin-text-dim);
}

.kpi-trend {
  color: var(--admin-success);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

/* --------------------------------------------------------------------------
   3. Tabs Navigation
   -------------------------------------------------------------------------- */
.admin-tabs-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--admin-border);
  margin-bottom: 1.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: #fff;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.tab-badge {
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-family: var(--font-mono, monospace);
}

.tab-btn.active .tab-badge {
  background: var(--admin-primary);
  color: #fff;
}

/* --------------------------------------------------------------------------
   4. Toolbar (Search, Filter, Export)
   -------------------------------------------------------------------------- */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 480px;
}

.toolbar-search input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(10, 14, 26, 0.85);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 0.65rem 1rem 0.65rem 2.4rem;
  color: #fff;
  font-size: 0.85rem;
  transition: all 0.25s ease;
}

.toolbar-search input:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.25);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--admin-text-dim);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-select {
  background: rgba(10, 14, 26, 0.85);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 0.6rem 2rem 0.6rem 0.85rem;
  color: var(--admin-text-main);
  font-size: 0.82rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.admin-select:focus {
  outline: none;
  border-color: var(--admin-primary);
}

/* --------------------------------------------------------------------------
   5. Data Table
   -------------------------------------------------------------------------- */
.admin-table-wrapper {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.admin-table th {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--admin-border);
  padding: 1rem 1.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--admin-text-muted);
}

.admin-table td {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  color: var(--admin-text-main);
}

.admin-table tbody tr {
  transition: background-color 0.2s ease;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.client-cell {
  display: flex;
  flex-direction: column;
}

.client-name {
  font-weight: 700;
  color: #fff;
}

.client-email {
  font-size: 0.75rem;
  font-family: var(--font-mono, monospace);
  color: var(--admin-text-muted);
  text-decoration: none;
}

.client-email:hover {
  color: var(--admin-primary);
  text-decoration: underline;
}

.service-pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--admin-border);
  color: #e2e8f0;
}

.budget-val {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: var(--admin-success);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-new {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.status-in_review {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.status-contacted {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.status-archived {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 0.45rem;
  cursor: pointer;
  color: #e2e8f0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--admin-danger);
}

/* --------------------------------------------------------------------------
   6. Security Access Gate Screen
   -------------------------------------------------------------------------- */
.security-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 8, 14, 0.94);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.security-gate-overlay.hidden {
  display: none !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-card {
  width: 100%;
  max-width: 440px;
  background: var(--admin-surface);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 18px;
  padding: 2.75rem 2.25rem;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8), 0 0 60px rgba(124, 58, 237, 0.2);
  position: relative;
  overflow: hidden;
}

.gate-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #7c3aed, #c084fc, #38bdf8);
}

.gate-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-inline: auto;
  margin-bottom: 1.5rem;
  color: #c084fc;
}

.gate-title {
  font-family: var(--font-display, inherit);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
}

.gate-desc {
  font-size: 0.85rem;
  color: var(--admin-text-muted);
  line-height: 1.5;
  margin-bottom: 1.75rem;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gate-input-wrapper {
  position: relative;
}

.gate-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  color: #fff;
  text-align: center;
  letter-spacing: 0.1em;
  font-family: var(--font-mono, monospace);
  transition: all 0.25s ease;
}

.gate-input:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.gate-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gate-hint {
  font-size: 0.75rem;
  color: var(--admin-text-dim);
  font-family: var(--font-mono, monospace);
  margin-top: 1rem;
}

/* --------------------------------------------------------------------------
   7. Brief Inspection Modal
   -------------------------------------------------------------------------- */
.brief-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.brief-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.brief-modal-card {
  width: 100%;
  max-width: 650px;
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 2.25rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  max-height: 90vh;
  overflow-y: auto;
}

.brief-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--admin-border);
}

.brief-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.35rem;
}

.brief-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.brief-meta-item label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--admin-text-muted);
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.brief-meta-item p {
  margin: 0;
  font-size: 0.9rem;
  color: #fff;
}

.brief-text-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre-wrap;
  margin-bottom: 1.75rem;
}

/* --------------------------------------------------------------------------
   8. System Diagnostics Tab
   -------------------------------------------------------------------------- */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.diag-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 1.75rem;
}

.diag-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.diag-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.diag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.diag-key {
  color: var(--admin-text-muted);
}

.diag-val {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  color: #fff;
}
