/* ============================================================
   common.css — Modern High-End Design System & Core Components
   ============================================================ */

:root {
  --bg: #090d16;
  --bg-gradient: radial-gradient(circle at 50% 0%, #172033 0%, #090d16 80%);
  --surface: #111827;
  --surface2: #1e293b;
  --surface3: #334155;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --accent: #38bdf8;
  --accent-light: rgba(56, 189, 248, 0.15);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --warn: #f59e0b;
  --warn-light: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: rgba(99, 102, 241, 0.5);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--accent);
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
}

/* ─── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface3);
  border-color: var(--border-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ─── FORM ELEMENTS ─────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
  text-align: left;
}

.form-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.form-input {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.95rem;
  color: var(--text);
  font-size: 0.9rem;
  transition: var(--transition);
  width: 100%;
}
.form-input:focus {
  outline: none;
  background: rgba(30, 41, 59, 0.95);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-row {
  display: flex;
  gap: 1rem;
}
.form-row .form-group {
  flex: 1;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ─── BADGES ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success { background: var(--success-light); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-danger  { background: var(--danger-light); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-warn    { background: var(--warn-light); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-muted   { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-accent  { background: var(--primary-light); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }

/* ─── LOADING SCREEN ────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.loader-logo { font-size: 3.2rem; animation: float 2.5s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }

.loader-title { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.loader-bar { width: 180px; height: 4px; background: var(--surface2); border-radius: var(--radius-full); overflow: hidden; }
.loader-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); animation: loadBar 1.2s ease-in-out infinite; }
.loader-msg { color: var(--text-muted); font-size: 0.85rem; }
@keyframes loadBar { 0%{width:0%} 50%{width:75%} 100%{width:100%} }

/* ─── MODALS ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #131d2e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: translateY(15px) scale(0.98);
  transition: transform 0.2s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.75rem;
}

/* ─── TOAST NOTIFICATIONS ───────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
  max-width: 400px;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  font-size: 0.88rem;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: all;
  border-left: 4px solid var(--primary);
  animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warn    { border-left-color: var(--warn); }
@keyframes toastSlide {
  from { transform: translateX(100%) scale(0.95); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

/* ─── AUTH SCREENS ──────────────────────────────────────────── */
#auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  background-image: var(--bg-gradient);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-box {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.auth-logo { font-size: 2.8rem; margin-bottom: 0.75rem; }
.auth-title { font-size: 1.45rem; font-weight: 800; color: var(--text); margin-bottom: 0.35rem; }
.auth-sub { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.75rem; line-height: 1.5; }

.auth-tab-bar { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; background: var(--surface2); padding: 0.25rem; border-radius: var(--radius-sm); }
.auth-tab {
  flex: 1; padding: 0.55rem;
  background: transparent; border: none;
  color: var(--text-muted); border-radius: var(--radius-xs);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.auth-tab.active { background: var(--primary); color: #ffffff; box-shadow: var(--shadow-sm); }
