/* ============================================================
   DeepWeave — Admin Dashboard Stylesheet
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #060810; --bg-s: #0b0d16; --bg-card: #10131e; --bg-el: #161a28;
  --blue: #4d8ef7; --blue-h: #6da3fa; --crimson: #c93554;
  --grad: linear-gradient(135deg, #4d8ef7, #c93554);
  --glow: rgba(77,142,247,0.12);
  --text: #eef0f6; --text-s: #9ba3b8; --text-m: #6b7280;
  --border: #1c2033; --border-l: #252a3e;
  --success: #22c55e; --warning: #f59e0b; --danger: #ef4444;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: inherit; text-decoration: none; }

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 260px; background: var(--bg-s); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; z-index: 100;
}
.sidebar-header {
  padding: 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.6rem;
}
.sidebar-header img { height: 32px; }
.sidebar-header .brand { font-weight: 700; font-size: 1.1rem; }
.sidebar-header .brand .b { color: var(--blue); }
.sidebar-header .brand .c { color: var(--crimson); }
.sidebar-header .badge {
  font-family: var(--mono); font-size: 0.6rem; padding: 0.2rem 0.5rem;
  background: var(--glow); border: 1px solid rgba(77,142,247,0.15);
  border-radius: 4px; color: var(--blue); margin-left: auto;
}

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.sidebar-nav .nav-section {
  font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-m); padding: 1rem 0.75rem 0.5rem;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.75rem; border-radius: 8px; font-size: 0.88rem;
  color: var(--text-s); transition: all 0.2s; margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--glow); color: var(--text); }
.sidebar-nav a.active { background: var(--glow); color: var(--blue); font-weight: 600; }
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav a .count {
  margin-left: auto; font-family: var(--mono); font-size: 0.7rem;
  background: rgba(201,53,84,0.15); color: var(--crimson);
  padding: 0.15rem 0.5rem; border-radius: 100px;
}

.sidebar-user {
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.75rem;
}
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 0.85rem; color: #fff;
}
.sidebar-user .info { flex: 1; }
.sidebar-user .info .name { font-size: 0.85rem; font-weight: 600; }
.sidebar-user .info .role { font-size: 0.72rem; color: var(--text-m); }

/* Main */
.admin-main { flex: 1; margin-left: 260px; }

.admin-topbar {
  padding: 1.25rem 2rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(6,8,16,0.8); backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 50;
}
.admin-topbar h1 { font-family: 'Instrument Serif', serif; font-size: 1.5rem; }
.admin-topbar .topbar-actions { display: flex; align-items: center; gap: 1rem; }
.topbar-search {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.85rem;
}
.topbar-search input {
  background: none; border: none; color: var(--text); outline: none;
  font-family: var(--font); font-size: 0.85rem; width: 180px;
}
.topbar-search input::placeholder { color: var(--text-m); }
.topbar-search svg { width: 16px; height: 16px; color: var(--text-m); }

.admin-content { padding: 2rem; }

/* Stat Cards */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.5rem; transition: border-color 0.3s;
}
.stat-card:hover { border-color: var(--border-l); }
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-m); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.4rem; }
.stat-card .stat-label svg { width: 14px; height: 14px; }
.stat-card .stat-val { font-family: 'Instrument Serif', serif; font-size: 2rem; line-height: 1; }
.stat-card .stat-change {
  font-family: var(--mono); font-size: 0.7rem; margin-top: 0.5rem;
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.5rem; border-radius: 4px;
}
.stat-card .stat-change.up { background: rgba(34,197,94,0.1); color: var(--success); }
.stat-card .stat-change.down { background: rgba(239,68,68,0.1); color: var(--danger); }

/* Table */
.enquiries-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
}
.panel-header {
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-header h2 { font-family: 'Instrument Serif', serif; font-size: 1.2rem; }
.panel-header .filters { display: flex; gap: 0.5rem; }
.filter-btn {
  padding: 0.4rem 0.85rem; font-family: var(--font); font-size: 0.78rem;
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-s); cursor: pointer; transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--border-l); }
.filter-btn.active { background: var(--glow); border-color: rgba(77,142,247,0.2); color: var(--blue); }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 0.85rem 1.5rem; font-family: var(--mono); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-m);
  text-align: left; border-bottom: 1px solid var(--border); font-weight: 500;
}
tbody tr { transition: background 0.2s; cursor: pointer; }
tbody tr:hover { background: rgba(77,142,247,0.03); }
tbody td { padding: 1rem 1.5rem; font-size: 0.88rem; border-bottom: 1px solid rgba(28,32,51,0.5); }

.status-badge {
  font-family: var(--mono); font-size: 0.68rem; padding: 0.25rem 0.65rem;
  border-radius: 100px; font-weight: 500; display: inline-flex; align-items: center; gap: 0.3rem;
}
.status-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.status-badge.new { background: rgba(77,142,247,0.1); color: var(--blue); }
.status-badge.new::before { background: var(--blue); }
.status-badge.contacted { background: rgba(245,158,11,0.1); color: var(--warning); }
.status-badge.contacted::before { background: var(--warning); }
.status-badge.closed { background: rgba(34,197,94,0.1); color: var(--success); }
.status-badge.closed::before { background: var(--success); }

.service-pill {
  font-size: 0.72rem; padding: 0.2rem 0.55rem;
  background: rgba(77,142,247,0.06); border: 1px solid rgba(77,142,247,0.1);
  border-radius: 4px; color: var(--text-s); font-family: var(--mono);
}

.table-empty {
  padding: 3rem; text-align: center; color: var(--text-m); font-size: 0.9rem;
}

/* Detail Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px); z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px;
  width: 560px; max-width: 95vw; max-height: 85vh; overflow-y: auto;
  animation: fadeInUp 0.3s cubic-bezier(0.16,1,0.3,1);
}
.modal-header {
  padding: 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-family: 'Instrument Serif', serif; font-size: 1.25rem; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: none; color: var(--text-s); cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all 0.2s;
}
.modal-close:hover { border-color: var(--danger); color: var(--danger); }
.modal-body { padding: 1.5rem; }
.detail-row { margin-bottom: 1.25rem; }
.detail-row .label { font-size: 0.72rem; font-family: var(--mono); color: var(--text-m); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.3rem; }
.detail-row .value { font-size: 0.92rem; color: var(--text); line-height: 1.6; }
.detail-row .value.message { background: var(--bg); border-radius: 10px; padding: 1rem; border: 1px solid var(--border); }
.modal-actions {
  padding: 1.25rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; gap: 0.75rem; justify-content: flex-end;
}
.modal-btn {
  padding: 0.55rem 1.25rem; font-family: var(--font); font-size: 0.82rem;
  font-weight: 600; border-radius: 8px; cursor: pointer; transition: all 0.2s; border: none;
}
.modal-btn.primary { background: var(--grad); color: #fff; }
.modal-btn.primary:hover { box-shadow: 0 6px 20px rgba(77,142,247,0.3); }
.modal-btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text-s); }
.modal-btn.secondary:hover { border-color: var(--border-l); }
.modal-btn.danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: var(--danger); }
.modal-btn.danger:hover { background: rgba(239,68,68,0.15); }

/* Responsive */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .admin-main { margin-left: 0; padding: 1.5rem 1rem; }
  .stats-row { grid-template-columns: 1fr; gap: 1rem; }
  .section-header h2 { font-size: 1.5rem; }
  .card { padding: 1.5rem; }
  thead { display: none; }
  tbody td { display: block; padding: 0.5rem 1.5rem; border: none; }
  tbody td:first-child { padding-top: 1rem; }
  tbody td:last-child { padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
  tbody td::before {
    content: attr(data-label); display: block; font-family: var(--mono);
    font-size: 0.65rem; color: var(--text-m); text-transform: uppercase;
    letter-spacing: 0.08em; margin-bottom: 0.25rem;
  }
  .auth-modal { padding: 2rem 1.5rem; }
}

@keyframes fadeInUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

/* Authentication Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 16, 0.98);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-l);
  border-radius: 16px;
  padding: 3rem 2.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header img {
  margin: 0 auto 1rem;
}

.auth-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-header p {
  color: var(--text-s);
  font-size: 0.9rem;
}

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

.auth-form input {
  padding: 0.875rem 1.25rem;
  background: var(--bg-el);
  border: 1px solid var(--border-l);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  transition: all 0.2s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(77, 142, 247, 0.1);
}

.auth-form button {
  padding: 0.875rem 1.25rem;
  background: var(--grad);
  border: none;
  border-radius: 8px;
  color: white;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.auth-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(77, 142, 247, 0.3);
}

.auth-form button:active {
  transform: translateY(0);
}

.auth-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-error {
  color: var(--danger);
  font-size: 0.875rem;
  text-align: center;
  min-height: 1.25rem;
}
