/* ============================================================
   main.css - Global Styles
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary:    #7c3aed;
  --primary-d:  #6d28d9;
  --primary-l:  #ede9fe;
  --accent:     #f59e0b;
  --success:    #10b981;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --info:       #3b82f6;
  --bg:         #f5f3ff;
  --surface:    #ffffff;
  --surface2:   #faf9ff;
  --border:     #e5e7eb;
  --text:       #111827;
  --text-muted: #6b7280;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 2px 16px rgba(124,58,237,0.08);
  --shadow-lg:  0 8px 40px rgba(124,58,237,0.15);
  --font:       'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg:         #0f0a1e;
  --surface:    #1a1030;
  --surface2:   #221840;
  --border:     #2d2050;
  --text:       #f3f0ff;
  --text-muted: #9ca3af;
  --shadow:     0 2px 16px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ===== TYPOGRAPHY ===== */
h1 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: 40px; border: none;
  font-size: 0.9rem; font-weight: 700; font-family: var(--font);
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 14px rgba(124,58,237,0.35); }
.btn-primary:hover { background: var(--primary-d); box-shadow: 0 6px 20px rgba(124,58,237,0.45); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-l); }
.btn-success { background: var(--success); color: white; box-shadow: 0 4px 14px rgba(16,185,129,0.3); }
.btn-danger  { background: var(--danger);  color: white; box-shadow: 0 4px 14px rgba(239,68,68,0.3); }
.btn-ghost   { background: var(--surface2); color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: 7px 16px; font-size: 0.82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); }

/* ===== FORM ===== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 11px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 0.95rem; font-family: var(--font);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.form-control.error { border-color: var(--danger); }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }
.form-hint  { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

.input-group { position: relative; }
.input-group .form-control { padding-right: 44px; }
.input-group .input-icon {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); cursor: pointer; font-size: 0.9rem;
}

/* ===== BADGE ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-purple  { background: var(--primary-l); color: var(--primary); }

/* ===== AVATAR ===== */
.avatar {
  border-radius: 50%; object-fit: cover;
  background: var(--primary-l); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.avatar-sm  { width: 36px;  height: 36px;  font-size: 0.85rem; }
.avatar-md  { width: 56px;  height: 56px;  font-size: 1.2rem; }
.avatar-lg  { width: 80px;  height: 80px;  font-size: 1.8rem; }
.avatar-xl  { width: 120px; height: 120px; font-size: 2.5rem; }

/* ===== SPINNER ===== */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(124,58,237,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-card  { height: 120px; margin-bottom: 12px; }
.skeleton-text  { height: 16px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-avatar { width: 56px; height: 56px; border-radius: 50%; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ===== TOAST ===== */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 12px;
  background: var(--text); color: var(--surface);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: translateX(110%); opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 320px;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-success { background: #065f46; }
.toast-error   { background: #991b1b; }
.toast-warning { background: #92400e; }
.toast-info    { background: #1e40af; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--surface); border-radius: 20px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface2); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1rem; transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== PROGRESS BAR ===== */
.progress-wrap { background: var(--border); border-radius: 99px; overflow: hidden; height: 10px; }
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.5s ease;
}

/* ===== DIVIDER ===== */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 0.82rem; margin: 16px 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ===== NAVBAR ===== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
[data-theme="dark"] .navbar { background: rgba(26,16,48,0.9); }
.navbar-brand {
  font-size: 1.3rem; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-decoration: none;
}
.navbar-nav { display: flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 7px 14px; border-radius: 8px;
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
  transition: all 0.15s; text-decoration: none;
}
.nav-link:hover, .nav-link.active { color: var(--primary); background: var(--primary-l); text-decoration: none; }

/* ===== FOOTER ===== */
.footer {
  background: #1a0a2e; color: rgba(255,255,255,0.7);
  padding: 60px 24px 32px;
}
.footer-grid {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px;
}
.footer-brand { font-size: 1.4rem; font-weight: 800; color: white; margin-bottom: 12px; }
.footer-desc  { font-size: 0.875rem; line-height: 1.7; }
.footer-title { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.4); margin-bottom: 14px; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: rgba(255,255,255,0.65); font-size: 0.875rem; text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: white; }
.footer-bottom {
  max-width: 1100px; margin: 40px auto 0;
  padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; flex-wrap: wrap; gap: 10px;
}

/* ===== CONTAINER ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 0 20px; }

/* ===== SECTION ===== */
.section { padding: 80px 0; }
.section-title { text-align: center; margin-bottom: 48px; }
.section-title h2 { margin-bottom: 12px; }
.section-title p  { color: var(--text-muted); font-size: 1.05rem; }

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ===== STAT CARD ===== */
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 14px;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 8px; }
.empty-state p  { font-size: 0.875rem; }

/* ===== ALERT ===== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.875rem; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 18px; border: none; background: none;
  font-size: 0.875rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.15s; font-family: var(--font);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover  { color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.page-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
.page-btn:hover, .page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .navbar { padding: 0 16px; }
  .section { padding: 48px 0; }
  .hide-mobile { display: none !important; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
