@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary-50: #FFF7ED;
  --primary-100: #FFEDD5;
  --primary-400: #FB923C;
  --primary-500: #FF6B2C;
  --primary-600: #EA580C;
  --primary-700: #C2410C;

  --bg-primary: #0A0A0F;
  --bg-secondary: #12121A;
  --bg-tertiary: #1A1A25;
  --bg-elevated: #222230;
  --bg-hover: #2A2A38;

  --text-primary: #FFFFFF;
  --text-secondary: #B8B8CC;
  --text-muted: #7A7A8E;

  --border-default: #2A2A35;
  --border-hover: #3A3A45;
  --border-focus: var(--primary-500);

  --success: #22C55E;
  --success-bg: rgba(34,197,94,0.1);
  --warning: #F59E0B;
  --warning-bg: rgba(245,158,11,0.1);
  --error: #EF4444;
  --error-bg: rgba(239,68,68,0.1);
  --info: #3B82F6;
  --info-bg: rgba(59,130,246,0.1);

  --shadow-glow: 0 0 30px rgba(255,107,44,0.3);
  --gradient-primary: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-400) 100%);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --font-sans: 'Roboto', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── Light theme ── */
[data-theme="light"] {
  --bg-primary: #F5F5FA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #EEEEF6;
  --bg-elevated: #E7E7F2;
  --bg-hover: #DFDFEE;
  --text-primary: #0C0C1A;
  --text-secondary: #38384E;
  --text-muted: #6A6A84;
  --border-default: #D8D8EA;
  --border-hover: #C4C4D8;
  --shadow-glow: 0 0 30px rgba(255,107,44,0.2);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  min-height: 100vh;
}

/* ── Background ── */
.bg-pattern {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,107,44,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,107,44,0.05) 0%, transparent 30%),
    radial-gradient(circle at 20% 80%, rgba(255,143,92,0.03) 0%, transparent 25%);
}
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(255,107,44,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,107,44,0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page-content { position: relative; z-index: 1; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: 0.9rem; font-weight: 600;
  border: none; cursor: pointer; text-decoration: none;
  transition: all 0.2s ease; white-space: nowrap;
}
.btn-primary {
  background: var(--gradient-primary); color: #fff;
  box-shadow: 0 0 20px rgba(255,107,44,0.3);
}
.btn-primary:hover { opacity: 0.9; box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-elevated); color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-danger { background: var(--error-bg); color: var(--error); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Cards ── */
.card {
  background: var(--bg-secondary); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: 1.5rem;
}
.card-glass {
  background: rgba(18,18,26,0.8); backdrop-filter: blur(12px);
  border: 1px solid var(--border-default); border-radius: var(--radius-xl);
}
.card-elevated {
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: 1.5rem;
}

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.form-label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }
.form-input {
  background: var(--bg-tertiary); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: 0.625rem 0.875rem;
  color: var(--text-primary); font-family: var(--font-sans); font-size: 0.9rem;
  transition: border-color 0.2s; width: 100%;
}
.form-input:focus { outline: none; border-color: var(--border-focus); }
.form-input::placeholder { color: var(--text-muted); }
.form-input.error { border-color: var(--error); }
.form-error { font-size: 0.8rem; color: var(--error); }
.form-select {
  background: var(--bg-tertiary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23606070' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: 0.625rem 2.5rem 0.625rem 0.875rem;
  color: var(--text-primary); font-family: var(--font-sans); font-size: 0.9rem;
  cursor: pointer; appearance: none; width: 100%;
}
.form-select:focus { outline: none; border-color: var(--border-focus); }
.form-textarea {
  background: var(--bg-tertiary); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: 0.625rem 0.875rem;
  color: var(--text-primary); font-family: var(--font-sans); font-size: 0.9rem;
  resize: vertical; min-height: 100px; width: 100%;
}
.form-textarea:focus { outline: none; border-color: var(--border-focus); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full, 9999px); font-size: 0.75rem; font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-default { background: var(--bg-elevated); color: var(--text-secondary); }

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
}
.navbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 1.5rem; max-width: 1200px; margin: 0 auto;
}
.navbar-logo {
  font-size: 1.25rem; font-weight: 800; color: var(--text-primary);
  text-decoration: none; display: flex; align-items: center; gap: 0.5rem;
}
.navbar-logo span { color: var(--primary-500); }
.navbar-links { display: flex; align-items: center; gap: 1.5rem; }
.navbar-link { color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.navbar-link:hover { color: var(--text-primary); }

/* ── Toast ── */
#toast-container {
  position: fixed; top: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.875rem 1.25rem; border-radius: var(--radius-lg);
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideInRight 0.3s ease; min-width: 280px; max-width: 380px;
}
.toast-success { border-color: rgba(34,197,94,0.3); }
.toast-error { border-color: rgba(239,68,68,0.3); }
.toast-info { border-color: rgba(59,130,246,0.3); }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl); padding: 2rem; max-width: 480px; width: 90%;
  animation: scaleIn 0.2s ease;
}
.modal-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Table ── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-default); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg-tertiary); }
th { padding: 0.75rem 1rem; text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
td { padding: 0.875rem 1rem; border-top: 1px solid var(--border-default); font-size: 0.875rem; color: var(--text-secondary); }
tr:hover td { background: var(--bg-hover); }

/* ── Loader ── */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border-default);
  border-top-color: var(--primary-500); border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-center { display: flex; justify-content: center; align-items: center; padding: 3rem; }

/* ── Utilities ── */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-gradient { background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.glow { box-shadow: var(--shadow-glow); }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; } .gap-4 { gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── Section titles ── */
.section-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; letter-spacing: -0.02em; }
.section-subtitle { color: var(--text-muted); font-size: 1rem; margin-bottom: 1.5rem; }

/* ── Pagination ── */
.pagination { display: flex; gap: 0.5rem; align-items: center; justify-content: center; margin-top: 1.5rem; }
.page-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md); border: 1px solid var(--border-default);
  background: var(--bg-elevated); color: var(--text-secondary);
  cursor: pointer; font-size: 0.875rem; transition: all 0.2s;
}
.page-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.page-btn.active { background: var(--primary-500); border-color: var(--primary-500); color: #fff; }
