/* ══════════════════════════════════════════════════
   Fish Presence Admin Panel — styles.css
   Palette: #5BCEFA (cyan), #F5A9B8 (pink), #FFFFFF
   ══════════════════════════════════════════════════ */

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

:root {
  --cyan:   #5BCEFA;
  --pink:   #F5A9B8;
  --white:  #FFFFFF;
  --bg:     #0b0d14;
  --bg2:    #10131c;
  --card:   rgba(16, 19, 28, 0.65);
  --glass:  rgba(22, 26, 40, 0.55);
  --glass-border: rgba(91, 206, 250, 0.12);
  --glass-border-hover: rgba(91, 206, 250, 0.28);
  --text:   #e2e6ee;
  --muted:  #7b829a;
  --danger: #f5564a;
  --success:#34d399;
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow: 0 8px 32px rgba(0,0,0,.45);
  --transition: .22s cubic-bezier(.4,0,.2,1);
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Subtle animated gradient bg */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 15%, rgba(91,206,250,.07) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(245,169,184,.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Glass Utility ──────────────────────────────── */
.glass {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.glass-inner {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(91,206,250,.08);
  border-radius: var(--radius-sm);
}

/* ── Typography ─────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h3 { font-size: .95rem; font-weight: 600; margin-bottom: 10px; }
.subtitle { color: var(--muted); font-size: .85rem; font-weight: 400; margin-top: 2px; }
.muted { color: var(--muted); font-size: .8rem; }
.error-text { color: var(--danger); font-size: .82rem; margin-top: 8px; }

/* ── Hidden / Visible ───────────────────────────── */
.hidden { display: none !important; }
.visible { display: flex !important; }

/* ── Buttons ────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 28px;
  background: linear-gradient(135deg, var(--cyan), #3ab8e0);
  color: #000; font-weight: 700; font-size: .9rem;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 0 20px rgba(91,206,250,.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(91,206,250,.45);
}
.btn-primary:active { transform: scale(.97); }
.btn-primary.sm { padding: 8px 18px; font-size: .82rem; }

.btn-ghost {
  display: block; width: 100%;
  padding: 10px; margin-top: 8px;
  background: transparent;
  color: var(--muted); font-size: .82rem; font-weight: 500;
  border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition);
}
.btn-ghost:hover { color: var(--white); border-color: rgba(255,255,255,.2); }

.btn-danger {
  padding: 5px 12px;
  background: rgba(245,86,74,.12);
  color: var(--danger); font-size: .78rem; font-weight: 600;
  border: 1px solid rgba(245,86,74,.2); border-radius: 6px;
  cursor: pointer; transition: all var(--transition);
}
.btn-danger:hover { background: rgba(245,86,74,.22); }

.btn-copy {
  padding: 4px 10px;
  background: rgba(91,206,250,.08);
  color: var(--cyan); font-size: .75rem; font-weight: 600;
  border: 1px solid rgba(91,206,250,.15); border-radius: 6px;
  cursor: pointer; transition: all var(--transition);
}
.btn-copy:hover { background: rgba(91,206,250,.18); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08); border-radius: 8px;
  color: var(--text); cursor: pointer;
  transition: all var(--transition);
}
.icon-btn:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.15); }
.icon-btn.danger:hover { color: var(--danger); border-color: rgba(245,86,74,.3); }

/* ── Loader Spinner ─────────────────────────────── */
.btn-loader {
  width: 16px; height: 16px;
  border: 2.5px solid rgba(0,0,0,.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Inputs ─────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

input[type="text"],
input[type="url"],
input[type="password"],
select {
  padding: 10px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .88rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(91,206,250,.12);
}
input::placeholder { color: rgba(255,255,255,.2); }

.search-input {
  padding: 7px 12px;
  font-size: .82rem;
  width: 200px;
  background: rgba(255,255,255,.03);
}

select {
  cursor: pointer;
  appearance: auto;
}

/* ── Login Overlay ──────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(5,7,12,.92);
  backdrop-filter: blur(8px);
  animation: fadeIn .35s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.login-card {
  width: 100%; max-width: 400px;
  padding: 40px 36px;
  text-align: center;
}
.login-logo { margin-bottom: 28px; }
.login-logo svg { margin-bottom: 10px; filter: drop-shadow(0 0 18px rgba(91,206,250,.35)); }
.login-logo h1 { background: linear-gradient(135deg, var(--cyan), var(--pink)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }

#login-form { display: flex; flex-direction: column; gap: 16px; text-align: left; margin-top: 4px; }
#login-form .btn-primary { width: 100%; margin-top: 4px; }

/* ── Topbar ─────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: none;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-weight: 700; font-size: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.badge {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  padding: 3px 10px; border-radius: 20px;
  letter-spacing: .04em;
}
.badge-ok { background: rgba(52,211,153,.12); color: var(--success); border: 1px solid rgba(52,211,153,.25); }
.badge-err { background: rgba(245,86,74,.12); color: var(--danger); border: 1px solid rgba(245,86,74,.25); }
.badge-warn { background: rgba(251,191,36,.12); color: #fbbf24; border: 1px solid rgba(251,191,36,.25); }

.session-info { font-size: .78rem; color: var(--muted); margin-right: 4px; }

/* ── Settings Drawer ────────────────────────────── */
.drawer {
  position: fixed; top: 62px; right: 16px; z-index: 90;
  width: 300px; padding: 20px;
  animation: slideDown .25s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.drawer .field { margin-bottom: 12px; }
.field.row { flex-direction: row; align-items: center; justify-content: space-between; }
.field.row select { width: 80px; }

/* ── Dashboard ──────────────────────────────────── */
.dashboard {
  position: relative; z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  display: flex; flex-direction: column; gap: 20px;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.stat-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--glass-border-hover); }
.stat-icon {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}
.stat-icon.cyan  { background: rgba(91,206,250,.1);  color: var(--cyan); }
.stat-icon.pink  { background: rgba(245,169,184,.1); color: var(--pink); }
.stat-icon.white { background: rgba(255,255,255,.06); color: var(--white); }
.stat-body { display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: .75rem; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* Panels */
.panel { padding: 0; overflow: hidden; }
.panel-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.panel-actions { display: flex; align-items: center; gap: 8px; }
.panel-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid rgba(255,255,255,.05);
}

/* Role form */
.role-form { margin: 16px 20px; padding: 16px; }
.role-form-grid {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
}
.role-form-grid .field { flex: 1; min-width: 180px; }
.role-form-grid .btn-primary { flex-shrink: 0; align-self: flex-end; }

/* ── Tables ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted);
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid rgba(255,255,255,.06);
  user-select: none;
  white-space: nowrap;
}
th.sortable { cursor: pointer; transition: color var(--transition); }
th.sortable:hover { color: var(--cyan); }
th.sort-asc::after { content: ' ▲'; font-size: .6rem; }
th.sort-desc::after { content: ' ▼'; font-size: .6rem; }

tbody td {
  padding: 10px 16px;
  font-size: .84rem;
  border-bottom: 1px solid rgba(255,255,255,.03);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(91,206,250,.03); }
.placeholder-row td { text-align: center; padding: 32px; color: var(--muted); }

td .actions { display: flex; gap: 6px; }

/* UUID mono */
.uuid { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: .78rem; letter-spacing: -.01em; color: rgba(255,255,255,.7); }

/* Role badge */
.role-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: .75rem; font-weight: 700;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(91,206,250,.12), rgba(245,169,184,.12));
  color: var(--white);
  border: 1px solid rgba(91,206,250,.15);
}

/* ── Toasts ─────────────────────────────────────── */
#toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: .84rem; font-weight: 500;
  color: var(--text);
  animation: toastIn .3s ease;
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--cyan); }
.toast.fade-out { animation: toastOut .3s ease forwards; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(30px); } }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 14px; }
  .dashboard { padding: 12px 10px 30px; }
  .stats-row { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; }
  .search-input { width: 140px; }
  .panel-header { padding: 12px 14px; }
  .role-form-grid { flex-direction: column; }
  .role-form-grid .field { min-width: 0; }
  .drawer { width: calc(100vw - 32px); right: 16px; }
  td, th { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .login-card { margin: 12px; padding: 28px 20px; }
  .stats-row { gap: 10px; }
  .stat-card { padding: 14px; }
}

/* ── Scroll ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }

/* ── Selection ──────────────────────────────────── */
::selection { background: rgba(91,206,250,.3); color: #fff; }

/* ── Pulse animation for live dot ───────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 6px;
  animation: pulse 1.8s ease infinite;
}
