@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import './variables.css';
@import './animations.css';

@font-face {
  font-family: 'WeissenhofGrotesk';
  src: url('../../assets/fonts/weissenhofgrotesk-medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

/* Background grid */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(37,99,235,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,0.05) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* Ocean glow orbs */
.bg-orb {
  position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
}
.bg-orb--left {
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(14,165,233,0.18) 0%, rgba(37,99,235,0.1) 40%, transparent 70%);
  bottom: -200px; left: -200px;
  animation: orbBreath 7s ease-in-out infinite;
}
.bg-orb--right {
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, rgba(14,165,233,0.08) 40%, transparent 70%);
  bottom: -200px; right: -200px;
  animation: orbBreath 7s ease-in-out infinite 2s;
}
.bg-orb--top {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(56,189,248,0.08) 0%, transparent 70%);
  top: -100px; left: 50%; transform: translateX(-50%);
}

#particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* Layout */
.container {
  max-width: var(--container);
  margin: 0 auto; padding: 0 28px;
  position: relative; z-index: 1;
}
.section { padding: 100px 0; position: relative; z-index: 1; }
.section-header { text-align: center; margin-bottom: 64px; }
.section-title {
  font-family: 'WeissenhofGrotesk', 'Inter', sans-serif;
  font-size: clamp(32px, 4.5vw, 54px); font-weight: 700;
  color: var(--text); margin-bottom: 16px;
  text-shadow: 0 0 60px rgba(96,165,250,0.2);
}
.section-sub { font-size: 16px; color: var(--text-muted); max-width: 500px; margin: 0 auto; }

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, #93c5fd, #60a5fa, #38bdf8);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
  display: inline-block;
  padding-bottom: 0.12em;
  line-height: 1.15;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 22px;
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none; border: none; outline: none;
  font-family: 'Inter', sans-serif; transition: all var(--t);
  white-space: nowrap; position: relative; overflow: hidden;
}
.btn--primary {
  background: var(--blue); color: white; box-shadow: var(--glow);
}
.btn--primary:hover {
  background: var(--blue-mid);
  box-shadow: 0 0 40px rgba(37,99,235,0.55);
  transform: translateY(-2px);
}
.btn--ghost {
  background: rgba(255,255,255,0.06); color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost:hover {
  background: rgba(255,255,255,0.11); border-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}
.btn--danger {
  background: rgba(239,68,68,0.15); color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn--danger:hover { background: rgba(239,68,68,0.25); }
.btn--lg { padding: 13px 28px; font-size: 15px; border-radius: var(--radius-lg); }
.btn--sm { padding: 7px 14px; font-size: 13px; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* Card */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; transition: all var(--t);
}
.card:hover {
  background: var(--card-hover); border-color: var(--border-blue);
  transform: translateY(-3px); box-shadow: var(--shadow);
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 100px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
}
.badge--open     { background: rgba(34,197,94,0.12);  color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.badge--progress { background: rgba(251,191,36,0.12); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.badge--closed   { background: rgba(107,114,128,0.15);color: #9ca3af; border: 1px solid rgba(107,114,128,0.25); }
.badge--admin    { background: var(--blue-dim); color: var(--blue-light); border: 1px solid var(--border-blue); }
.badge--normal   { background: rgba(37,99,235,0.12);  color: #60a5fa; border: 1px solid rgba(37,99,235,0.25); }
.badge--high     { background: rgba(251,146,60,0.12); color: #fb923c; border: 1px solid rgba(251,146,60,0.25); }
.badge--urgent   { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }

/* Inputs */
.input, .select, .textarea {
  width: 100%; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; color: var(--text); font-size: 14px;
  font-family: inherit; outline: none;
  transition: border-color var(--t), background var(--t);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--blue); background: rgba(37,99,235,0.08);
}
.textarea { resize: vertical; min-height: 120px; }
.select option { background: #051525; color: var(--text); }
.form-group { margin-bottom: 18px; }

/* ── Custom Select ─────────────────────────────────────────────────────────── */
.ks-select { position: relative; user-select: none; width: 100%; }
.ks-select__trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  color: var(--text); font-size: 14px; font-family: inherit;
  cursor: pointer; outline: none;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}
.ks-select__trigger:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.07); }
.ks-select.open .ks-select__trigger {
  border-color: var(--blue); background: rgba(37,99,235,0.08);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.ks-select__val { flex: 1; text-align: left; }
.ks-select__caret { font-size: 10px; color: var(--text-muted); transition: transform 0.2s ease; flex-shrink: 0; }
.ks-select.open .ks-select__caret { transform: rotate(180deg); }
.ks-select__menu {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 400;
  background: #0b1829; border: 1px solid rgba(37,99,235,0.35);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  opacity: 0; transform: translateY(-6px) scale(0.98); pointer-events: none;
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.16,1,0.3,1);
}
.ks-select.open .ks-select__menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }
.ks-select__opt {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; font-size: 13px; color: var(--text-muted);
  cursor: pointer; transition: background 0.15s, color 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.ks-select__opt:last-child { border-bottom: none; }
.ks-select__opt:hover { background: rgba(37,99,235,0.12); color: white; }
.ks-select__opt.selected { color: white; background: rgba(37,99,235,0.07); }
.ks-select__opt-icon { width: 15px; text-align: center; color: var(--blue-light); font-size: 12px; flex-shrink: 0; }
.ks-select__check { margin-left: auto; color: var(--blue-light); font-size: 10px; opacity: 0; flex-shrink: 0; }
.ks-select__opt.selected .ks-select__check { opacity: 1; }

/* Compact variant (admin tables) */
.ks-select--sm .ks-select__trigger { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.ks-select--sm .ks-select__opt { padding: 8px 11px; font-size: 12px; }
.form-group label {
  display: block; margin-bottom: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}

/* Toast */
#toast-container {
  position: fixed; top: 90px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 14px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 380px;
  animation: toastIn 0.3s ease; backdrop-filter: blur(10px);
}
.toast--success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.toast--error   { background: rgba(239,68,68,0.15);  border: 1px solid rgba(239,68,68,0.3);  color: #f87171; }
.toast--info    { background: var(--blue-dim); border: 1px solid var(--border-blue); color: var(--blue-light); }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* Utilities */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-blue   { color: var(--blue-light); }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(37,99,235,0.4); border-radius: 3px; }
::selection { background: rgba(37,99,235,0.35); color: white; }
