/* ═══════════════════════════════════════════════════════════════════════════
   Modern Dashboard Design System
   Auto light/dark via prefers-color-scheme
   ═══════════════════════════════════════════════════════════════════════════ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 15px;
}

/* ── Light Theme ───────────────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root {
    --bg-base: #f8f9fc;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #f1f3f9;
    --bg-active: #e8ecf4;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f4f6fb;
    --bg-modal-overlay: rgba(15, 23, 42, 0.4);
    --border-color: #e2e6ef;
    --border-light: #eef1f8;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: #eef2ff;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success: #10b981;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --scrollbar-track: #f1f5f9;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;
  }

  body {
    background: var(--bg-base);
    color: var(--text-primary);
  }
}

/* ── Dark Theme ────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-base: #0c0e14;
    --bg-surface: #141722;
    --bg-elevated: #1a1e2e;
    --bg-hover: #1e2336;
    --bg-active: #252b40;
    --bg-sidebar: #141722;
    --bg-card: #141722;
    --bg-input: #1a1e2e;
    --bg-modal-overlay: rgba(0, 0, 0, 0.65);
    --border-color: #252b40;
    --border-light: #1e2336;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --accent-light: rgba(99, 102, 241, 0.12);
    --accent-glow: rgba(99, 102, 241, 0.2);
    --success: #34d399;
    --success-light: rgba(16, 185, 129, 0.1);
    --danger: #f87171;
    --danger-light: rgba(239, 68, 68, 0.1);
    --warning: #fbbf24;
    --warning-light: rgba(245, 158, 11, 0.1);
    --info: #60a5fa;
    --info-light: rgba(59, 130, 246, 0.1);
    --scrollbar-track: #141722;
    --scrollbar-thumb: #2a3050;
    --scrollbar-thumb-hover: #3a4060;
  }

  body {
    background: var(--bg-base);
    color: var(--text-primary);
  }
}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ── Typography ────────────────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* ── Overlay (noscript / loading) ──────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-weight: 500;
  gap: 12px;
}

/* ── Layout ────────────────────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.hero.is-fullheight {
  min-height: 100vh;
}

.hero-head {
  width: 100%;
}

.hero-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.columns.is-desktop-nowrap {
  flex-wrap: nowrap;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 6px;
  position: sticky;
  top: 20px;
  box-shadow: var(--shadow-sm);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.93rem;
  transition: all var(--transition);
  text-decoration: none;
  margin: 2px 0;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-item.is-active {
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: 600;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.sidebar-item.is-active:hover {
  background: var(--accent-hover);
  color: var(--text-inverse);
}

.sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: 6px 12px;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.box:hover {
  box-shadow: var(--shadow-md);
}

.box.is-shadowless {
  box-shadow: none;
}

.border {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.border-bottom {
  border-bottom: 1px solid var(--border-light);
}

/* ── Labels ────────────────────────────────────────────────────────────── */
.label {
  display: inline-block;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.label.notification {
  display: block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  margin-bottom: 16px;
}

/* ── Form Elements ─────────────────────────────────────────────────────── */
.input, .textarea, .select {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.93rem;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-surface);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-muted);
}

.input.is-rounded {
  border-radius: 999px;
  padding: 11px 20px;
}

.textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.textarea.is-rounded {
  border-radius: var(--radius);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
}

.button:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button.is-fullwidth {
  width: 100%;
}

.button.is-rounded {
  border-radius: 999px;
}

.button.is-small {
  padding: 7px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-xs);
}

.button.is-dark,
.button.is-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-inverse);
}

.button.is-dark:hover,
.button.is-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text-inverse);
}

.button.is-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.button.is-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.button.is-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
}

.pagination .button {
  border-radius: 999px;
}

/* ── Modal (Full-page) ────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.is-active {
  display: flex;
}

.modal-background {
  position: absolute;
  inset: 0;
  background: var(--bg-modal-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-content,
.modal-content.box {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 480px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0, 0, 0, 0.1);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content .columns {
  flex-direction: column;
  gap: 20px;
}

.modal-content .buttons {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-content .buttons .button {
  flex: 1;
  min-width: 0;
}

/* ── Notification Messages ─────────────────────────────────────────────── */
.notification {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* ── Utility Classes ───────────────────────────────────────────────────── */
.overflow {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.has-text-centered {
  text-align: center;
}

.has-text-weight-bold {
  font-weight: 700;
}

.is-size-5 { font-size: 1.15rem; }
.is-size-6 { font-size: 0.95rem; }
.is-size-7 { font-size: 0.8rem; }

.m-0 { margin: 0; }
.m-1 { margin: 4px; }
.m-2 { margin: 8px; }
.m-3 { margin: 12px; }
.m-5 { margin: 20px; }
.m-6 { margin: 24px; }

.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-5 { padding: 20px; }

.p-1 { padding: 4px; }

.is-flex {
  display: flex;
}

.is-align-items-center {
  align-items: center;
}

.is-justify-content-center {
  justify-content: center;
}

.is-justify-content-left {
  justify-content: flex-start;
}

.is-justify-content-right {
  justify-content: flex-end;
}

.is-justify-content-space-around {
  justify-content: space-around;
}

/* ── Icon Buttons ──────────────────────────────────────────────────────── */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.icon svg {
  width: 18px;
  height: 18px;
}

/* ── Loader ────────────────────────────────────────────────────────────── */
.loader {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Public Page Container ─────────────────────────────────────────────── */
.public-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

/* ── Inbox Item Accent ─────────────────────────────────────────────────── */
.inbox-accent {
  width: 4px;
  min-height: 100%;
  border-radius: 4px 0 0 4px;
  background: var(--success);
  flex-shrink: 0;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .columns.is-desktop-nowrap {
    flex-wrap: wrap;
  }

  .sidebar {
    position: static;
  }

  .hero.is-fullheight .container.is-max-desktop {
    padding-top: 16px;
  }
}

/* ── Focus Visible ─────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Selection ─────────────────────────────────────────────────────────── */
::selection {
  background: var(--accent-glow);
  color: var(--text-primary);
}

/* ── Chart Container ───────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
  padding: 12px 0;
}

/* ── File Upload ───────────────────────────────────────────────────────── */
.file.is-fullwidth {
  width: 100%;
}

/* ── Password Copy Area ────────────────────────────────────────────────── */
.copy-area {
  cursor: pointer;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
}

.copy-area:hover {
  background: var(--bg-hover);
}

/* ── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ── Search Bar ────────────────────────────────────────────────────────── */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}

.search-bar .input {
  padding-right: 48px;
}

.search-bar-btn {
  position: absolute;
  right: 0px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 14px !important;
}

.search-bar-btn:hover {
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar-btn:active {
  transform: translateY(-50%) scale(0.96);
}

/* ── Status Dot ────────────────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
