/* ============================================
   Admin Dashboard — Premium Dark Theme
   ============================================ */

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

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg:          #080d18;
  --surface:     #0e1628;
  --surface-2:   #131f35;
  --border:      #1e2f4d;
  --accent:      #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --accent-soft: rgba(59, 130, 246, 0.10);
  --danger:      #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --text:        #e2e8f0;
  --muted:       #64748b;
  --success:     #22c55e;
  --radius:      14px;
  --shadow:      0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-sm:   0 2px 8px  rgba(0, 0, 0, 0.30);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---------- Animated grid background ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Layout ---------- */
.admin-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---------- Header ---------- */
.admin-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}

.admin-logo {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
  flex-shrink: 0;
}

.admin-header-text h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.admin-header-text p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 1px;
}

/* ---------- Status badge ---------- */
.status-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
}

.status-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.status-badge.online .dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse 2s infinite;
}

.status-badge.online {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.25);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ---------- Login Card ---------- */
#loginBox {
  max-width: 420px;
  margin: 80px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: fadeUp 0.4s ease;
}

#loginBox .login-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

#loginBox h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

#loginBox p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

/* ---------- Input ---------- */
.input-group {
  position: relative;
  margin-bottom: 16px;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="password"]:focus,
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder {
  color: var(--muted);
}

/* ---------- Buttons ---------- */
button {
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 16px var(--accent-glow);
  margin-top: 8px;
}

.btn-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-danger {
  padding: 6px 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
}

/* ---------- Dashboard (post-login) ---------- */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.dashboard-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.record-count {
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 999px;
}

/* ---------- Table ---------- */
#contactTable {
  width: 100%;
  border-collapse: collapse;
  border: none;
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fadeUp 0.35s ease;
}

#contactTable thead {
  background: var(--surface-2);
}

#contactTable th {
  padding: 14px 18px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#contactTable td {
  padding: 14px 18px;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  max-width: 280px;
  word-break: break-word;
}

#contactTable tbody tr:last-child td {
  border-bottom: none;
}

#contactTable tbody tr {
  transition: background 0.15s;
}

#contactTable tbody tr:hover {
  background: var(--surface-2);
}

/* ID column */
#contactTable td:first-child {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.95rem;
}

/* ---------- Toast notification ---------- */
#toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

#toast.success { border-color: rgba(34,197,94,0.35); color: var(--success); }
#toast.error   { border-color: rgba(239,68,68,0.35);  color: var(--danger);  }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .admin-wrapper { padding: 24px 16px 60px; }
  #loginBox      { padding: 28px 20px; margin-top: 40px; }

  #contactTable th,
  #contactTable td { padding: 12px 12px; font-size: 0.82rem; }

  .admin-header h1 { font-size: 1.2rem; }
  .status-badge    { display: none; }
}
