/* ─── Base / shared (UptimeStatus-style dark glass) ─────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --border: #334155;
  --border-light: #475569;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.22);
  --success: #22c55e;
  --error: #f87171;
  --warning: #f59e0b;
  --gold: #d4a017;
  --gold-soft: rgba(212, 160, 23, 0.12);
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

html { font-size: 15px; }

body {
  background: linear-gradient(130deg, #0b1220 0%, #0f172a 44%, #131c31 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Animated background (orbs + grid) ─────────────────────────────────────── */
.bg-effects { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-orb { position: absolute; border-radius: 9999px; filter: blur(72px); opacity: 0.35; will-change: transform; }
.bg-orb-1 {
  width: min(42vw, 520px); height: min(42vw, 520px); top: -20%; left: -10%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 122, 24, 0.85), rgba(255, 122, 24, 0));
  animation: orbFloat1 15s ease-in-out infinite alternate;
}
.bg-orb-2 {
  width: min(44vw, 560px); height: min(44vw, 560px); right: -18%; top: 45%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 87, 46, 0.8), rgba(255, 87, 46, 0));
  animation: orbFloat2 18s ease-in-out infinite alternate;
}
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.25;
}

@keyframes orbFloat1 { from { transform: translate(0, 0); } to { transform: translate(60px, 40px); } }
@keyframes orbFloat2 { from { transform: translate(0, 0); } to { transform: translate(-70px, -50px); } }
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Layout & main glass card ─────────────────────────────────────────────── */
.container {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto;
  padding: 64px 20px;
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}

.card {
  position: relative; width: 100%;
  background:
    radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.12) 1px, transparent 1px),
    linear-gradient(160deg, rgba(17, 24, 39, 0.82) 0%, rgba(15, 23, 42, 0.72) 100%);
  background-size: 24px 24px, 100% 100%;
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(212, 160, 23, 0.22);
  border-radius: 18px;
  padding: 36px 28px 28px;
  box-shadow:
    0 20px 50px rgba(2, 6, 23, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  animation: fadeSlideUp 0.4s ease both;
  overflow: hidden;
}

/* Noise texture overlay */
.card > * { position: relative; z-index: 1; }
.card::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 18px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
}

/* Faint gold halo behind the card */
.card-halo {
  position: absolute; inset: -3px;
  border-radius: 22px;
  background: radial-gradient(60% 40% at 50% 0%, rgba(212, 160, 23, 0.15), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* Gold glow on top border — bright center, fades to sides */
.card-glow {
  position: absolute; top: 0; left: 20px; right: 20px; height: 1px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, transparent 0%, rgba(212, 160, 23, 0.95) 50%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

/* ─── Profile ──────────────────────────────────────────────────────────────── */
.profile { text-align: center; margin-bottom: 26px; }

.avatar {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(212, 160, 23, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 4px 12px rgba(0, 0, 0, 0.3);
  margin-bottom: 14px;
}

.name { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
.bio { font-size: 0.88rem; color: var(--text-muted); margin-top: 4px; }

/* ─── Links ────────────────────────────────────────────────────────────────── */
.links { display: flex; flex-direction: column; gap: 10px; }

.link-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  text-decoration: none;
  position: relative;
  transition: all 0.25s ease;
}
.link-btn::before {
  content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent); opacity: 0;
  transition: opacity 0.25s ease;
}
.link-btn:hover {
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.15) 0%, rgba(99, 102, 241, 0.18) 100%);
  border-color: rgba(212, 160, 23, 0.5);
  box-shadow: 0 8px 24px rgba(212, 160, 23, 0.15), 0 0 0 1px rgba(212, 160, 23, 0.1);
  transform: translateY(-2px);
}
.link-btn:hover::before { opacity: 1; }
.link-btn:active { transform: translateY(-1px) scale(0.99); }

.link-emoji {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(212, 160, 23, 0.1) 100%);
  font-size: 1.2rem;
  transition: background 0.25s ease;
}
.link-btn:hover .link-emoji {
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.25) 0%, rgba(99, 102, 241, 0.2) 100%);
}
.link-favicon { width: 20px; height: 20px; border-radius: 4px; object-fit: contain; }
.link-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.link-title { font-size: 0.95rem; font-weight: 600; }
.link-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }
.link-arrow {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.25s ease;
}
.link-btn:hover .link-arrow { color: #f8fafc; background: rgba(212, 160, 23, 0.2); }

.empty { text-align: center; color: var(--text-muted); padding: 32px 16px; font-size: 0.9rem; }

/* ─── Footer ───────────────────────────────────────────────────────────────── */
.footer { margin-top: 26px; text-align: center; font-size: 0.72rem; color: var(--text-muted); }
.footer-brand a { color: var(--text-muted); text-decoration: none; }
.footer-brand a:hover { color: var(--gold); }

/* ─── Shared form/button styles (login + admin) ────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; }
.field-label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.field-input {
  width: 100%;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.88rem; font-family: inherit; color: var(--text); background: rgba(255, 255, 255, 0.04);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }

.btn {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
  padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition); font-family: inherit; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-danger { color: var(--error); }
.btn-danger:hover { border-color: var(--error); color: var(--error); }

/* ─── Login ────────────────────────────────────────────────────────────────── */
.container-center { align-items: center; justify-content: center; }
.login-card { max-width: 380px; margin: 0 auto; }
.login-title { font-size: 1.3rem; font-weight: 700; text-align: center; margin-bottom: 18px; }
.login-form .btn-block { margin-top: 4px; }
.login-error {
  margin-bottom: 14px; padding: 10px 14px; border-radius: 8px; font-size: 0.82rem;
  color: #fecaca; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ─── Admin (clean layout) ─────────────────────────────────────────────────── */
.admin-page .container { max-width: 700px; }
.admin-card { max-width: 640px; padding: 28px 24px 24px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.admin-title { font-size: 1.25rem; font-weight: 700; }
.admin-header-right { display: flex; gap: 8px; flex-shrink: 0; }

/* Each "panel" is a soft glass sub-card inside the main card */
.panel {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  padding: 18px 18px 14px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.03);
}
.panel + .panel { margin-top: 0; }

.panel-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 14px;
}
.panel-body { margin-bottom: 0; }
.panel-body.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.panel-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* Link rows in admin */
.link-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
  transition: all var(--transition);
  position: relative;
}
.link-row::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent); opacity: 0.4;
  transition: opacity var(--transition);
}
.link-row:hover { border-color: rgba(129, 140, 248, 0.45); background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%); }
.link-row:hover::before { opacity: 1; }

.link-emoji {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(99, 102, 241, 0.12); font-size: 1.1rem;
}
.link-favicon { width: 18px; height: 18px; border-radius: 4px; object-fit: contain; }
.link-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.link-title { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-sub { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-url { font-size: 0.68rem; color: var(--text-muted); opacity: 0.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.row-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.item-row-btn {
  background: transparent; border: 1px solid transparent; cursor: pointer; color: var(--text-muted);
  width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0; font-size: 0.85rem; line-height: 1;
}
.item-row-btn:hover { color: var(--accent); background: var(--accent-soft); border-color: rgba(99, 102, 241, 0.2); }
.item-row-btn.danger:hover { color: var(--error); background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.2); }

/* Add-link form (hidden until + Add Link) */
.add-link-form { display: none; flex-direction: column; gap: 10px; margin-top: 10px; }
.add-link-form.visible { display: flex; }
.add-link-form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.add-link-form .field { margin-bottom: 0; }
.add-link-form .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }

/* Edit-link form (hidden by default) */
.edit-link-form { display: none; flex-direction: column; gap: 10px; margin-top: 10px; padding: 14px; border: 1px solid var(--accent); border-radius: 10px; background: rgba(99, 102, 241, 0.08); }
.edit-link-form.visible { display: flex; }
.edit-link-form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.edit-link-form .field { margin-bottom: 0; }
.edit-link-form .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }

/* Toggle switch */
.toggle-field {
  display: flex; align-items: center; gap: 12px; cursor: pointer; margin-bottom: 6px;
}
.toggle-field input { display: none; }
.toggle-switch {
  position: relative; width: 40px; height: 22px; flex-shrink: 0;
  background: var(--border); border-radius: 11px; transition: background var(--transition);
}
.toggle-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-muted); transition: transform var(--transition), background var(--transition);
}
.toggle-field input:checked + .toggle-switch { background: var(--accent); }
.toggle-field input:checked + .toggle-switch::after { transform: translateX(18px); background: #fff; }
.toggle-label { font-size: 0.88rem; font-weight: 500; color: var(--text); }
.toggle-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* Toast */
.admin-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 10px; font-size: 0.85rem; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease; z-index: 3000;
}
.admin-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.admin-toast.error { border-color: var(--error); color: #fecaca; }

@media (max-width: 600px) {
  .panel-body.grid-2, .add-link-form .grid-2, .edit-link-form .grid-2 { grid-template-columns: 1fr; }
  .admin-header { flex-direction: column; align-items: flex-start; }
}

@media (min-width: 768px) {
  .container { max-width: 560px; }
}
