/* ── Crab — Unified App CSS ── */

:root {
  --bg: #0a0e1a;
  --bg-sidebar: #0d1224;
  --bg-card: #111827;
  --bg-input: #1a2236;
  --bg-hover: #1e293b;
  --border: #1e2d4a;
  --text: #e2e8f0;
  --text-dim: #64748b;
  --text-muted: #475569;
  --accent: #00b4d8;
  --accent-hover: #0096c7;
  --accent-glow: rgba(0,180,216,0.15);
  --green: #06d6a0;
  --red: #ef476f;
  --orange: #ffa726;
  --blue: #42a5f5;
  --cyan: #00b4d8;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); overflow: hidden; }

/* ═══ LOGIN ═══ */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(0,180,216,0.08) 0%, transparent 60%), var(--bg);
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 40px 36px; width: 390px; text-align: center; box-shadow: var(--shadow);
}
.login-icon { font-size: 48px; margin-bottom: 8px; }
.login-title {
  font-size: 26px; font-weight: 800;
  background: linear-gradient(135deg, #00b4d8, #0077b6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-subtitle { font-size: 13px; color: var(--text-dim); margin: 4px 0 24px; }

.auth-tabs { display: flex; background: var(--bg-input); border-radius: 8px; padding: 3px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; padding: 8px; border-radius: 6px; background: none; border: none;
  color: var(--text-dim); font-size: 13px; font-weight: 600; font-family: var(--font); cursor: pointer; transition: all .2s;
}
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-tab:hover:not(.active) { color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text); font-size: 14px; font-family: var(--font); outline: none; transition: all .2s;
}
.auth-form input::placeholder { color: var(--text-dim); }
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.auth-msg { margin-top: 12px; font-size: 12px; padding: 8px 12px; border-radius: 8px; }
.auth-msg.error { background: rgba(239,71,111,0.12); color: var(--red); }
.auth-msg.success { background: rgba(6,214,160,0.12); color: var(--green); }

/* ═══ BUTTONS ═══ */
.btn {
  padding: 10px 20px; border-radius: var(--radius); border: none;
  font-weight: 600; font-size: 13px; font-family: var(--font); cursor: pointer; transition: all .2s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #00b4d8, #0077b6); color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #0096c7, #005f8a); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-inline { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12px; font-family: var(--font); padding: 4px 8px; border-radius: 6px; transition: all .15s; }
.btn-inline:hover { background: var(--accent-glow); }
.btn-inline.danger { color: var(--red); }
.btn-inline.danger:hover { background: rgba(239,71,111,0.12); }

/* ═══ ADMIN DASHBOARD ═══ */
.dashboard { display: flex; height: 100vh; }

.sidebar {
  width: 220px; background: var(--bg-sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 18px 16px; border-bottom: 1px solid var(--border); }
.brand-icon { font-size: 22px; }
.brand-name { font-size: 18px; font-weight: 800; background: linear-gradient(135deg, #00b4d8, #0077b6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.brand-badge { font-size: 9px; background: var(--accent); color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px;
  color: var(--text-dim); text-decoration: none; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; background: none; font-family: var(--font); width: 100%; text-align: left; transition: all .15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
.sidebar-email { display: block; font-size: 11px; color: var(--text-dim); padding: 4px 12px; margin-bottom: 4px; word-break: break-all; }
.logout-item:hover { color: var(--red) !important; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; border-bottom: 1px solid var(--border); background: var(--bg-sidebar); }
.topbar h2 { font-size: 18px; font-weight: 700; }
.content { flex: 1; padding: 24px 28px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; display: flex; align-items: center; gap: 14px; transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.blue { background: rgba(66,165,245,0.12); }
.stat-icon.green { background: rgba(6,214,160,0.12); }
.stat-icon.cyan { background: rgba(0,180,216,0.12); }
.stat-icon.orange { background: rgba(255,167,38,0.12); }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* Section */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h3 { font-size: 16px; font-weight: 700; }

/* Table */
.table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead { background: var(--bg-sidebar); }
.data-table th { padding: 12px 16px; text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge.yes { background: rgba(6,214,160,0.15); color: var(--green); }
.badge.no { background: rgba(239,71,111,0.15); color: var(--red); }
.badge.admin-role { background: rgba(0,180,216,0.15); color: var(--cyan); }
.badge.active { background: rgba(6,214,160,0.15); color: var(--green); }
.badge.expired { background: rgba(239,71,111,0.15); color: var(--red); }
.badge.pending { background: rgba(255,167,38,0.15); color: var(--orange); }

.empty-cell { text-align: center; color: var(--text-dim); padding: 32px 16px !important; }

/* ═══ USER DASHBOARD ═══ */
.user-dashboard { height: 100vh; overflow-y: auto; }
.user-navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; border-bottom: 1px solid var(--border);
  background: rgba(13,18,36,0.9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 100;
}
.nav-brand { display: flex; align-items: center; gap: 8px; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-email { font-size: 12px; color: var(--text-dim); }

.user-content { max-width: 700px; margin: 32px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 20px; }
.u-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-body { padding: 20px 22px; }
.card-text { font-size: 13px; color: var(--text-dim); line-height: 1.6; margin-bottom: 16px; }

.info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.info-value { font-size: 13px; font-weight: 600; }

.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-dim); }
.step-n { width: 28px; height: 28px; background: var(--accent-glow); color: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.step code { background: var(--bg-input); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--accent); }
.step b { color: var(--text); }

/* ═══ MODAL ═══ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 480px; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(0,0,0,0.5); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 22px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-body label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; margin-top: 14px; }
.modal-body label:first-child { margin-top: 0; }
.modal-body input, .modal-body select, .modal-body textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text); font-size: 13px; font-family: var(--font); outline: none; transition: all .2s;
}
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.modal-body textarea { min-height: 120px; resize: vertical; font-family: 'SF Mono', 'Cascadia Code', monospace; font-size: 12px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }

@media (max-width: 768px) {
  .sidebar { width: 60px; } .sidebar .brand-name, .sidebar .brand-badge, .sidebar .nav-item span:not(.nav-icon), .sidebar-email { display: none; }
  .content { padding: 16px; }
}

[hidden] {
  display: none !important;
}
