/* ================================================
   WEBLIOO — Design System Global
   ================================================ */

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

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

:root {
  --primary:       #6366f1;
  --primary-hover: #5558e3;
  --primary-light: #818cf8;
  --primary-glow:  rgba(99,102,241,0.35);
  --secondary:     #ec4899;
  --secondary-hover: #db2777;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;

  --bg-base:       #0a0f1e;
  --bg-card:       #111827;
  --bg-card-2:     #1a2235;
  --bg-input:      #1a2235;
  --bg-sidebar:    #0d1525;

  --border:        rgba(148,163,184,0.12);
  --border-focus:  rgba(99,102,241,0.6);
  --border-hover:  rgba(148,163,184,0.25);

  --text-1: #f8fafc;
  --text-2: #cbd5e1;
  --text-3: #94a3b8;
  --text-4: #475569;

  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
  --gradient-dark:  linear-gradient(135deg, #0a0f1e 0%, #111827 100%);
  --gradient-glow:  linear-gradient(135deg, rgba(99,102,241,0.2) 0%, rgba(236,72,153,0.1) 100%);

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.5);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:   0 16px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.35);

  --r-sm:   6px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  --t-fast: 0.15s ease;
  --t-base: 0.3s cubic-bezier(0.4,0,0.2,1);
  --t-spring: 0.5s cubic-bezier(0.34,1.56,0.64,1);

  --sidebar-w: 260px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

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

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: var(--t-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 4px 20px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--primary-glow);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(99,102,241,0.12);
  color: var(--primary-light);
  border: 1px solid rgba(99,102,241,0.3);
}
.btn-secondary:hover {
  background: rgba(99,102,241,0.2);
  border-color: var(--primary);
}

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-ghost {
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text-1); }

.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-icon { padding: 10px; border-radius: var(--r-md); }

.btn-loading::before {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: var(--t-base);
}
.card:hover { border-color: var(--border-hover); }

.card-gradient {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-2) 100%);
  border: 1px solid var(--border);
}

.card-glow {
  box-shadow: var(--shadow-glow);
  border-color: rgba(99,102,241,0.3);
}

/* ---- Form elements ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  padding: 12px 16px;
  transition: var(--t-fast);
  width: 100%;
  outline: none;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-4); }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.form-textarea { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.input-group { position: relative; }
.input-group .form-input { padding-left: 42px; }
.input-group .input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-4); font-size: 16px; pointer-events: none; }

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-info    { background: rgba(59,130,246,0.15);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge-primary { background: rgba(99,102,241,0.15);  color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }

/* ---- Table ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-4);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---- Modal ---- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 40px 80px rgba(0,0,0,0.7);
}
.modal-content.modal-lg { max-width: 720px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t-fast);
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text-1); }
.modal-body { padding: 28px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
}

/* ---- Divider ---- */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-4);
  font-size: 13px;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.4); }

/* ---- Stat Card ---- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--t-base);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  right: 0; height: 3px;
  background: var(--gradient-brand);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-card:hover::before { transform: scaleX(1); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.stat-value {
  font-size: 32px;
  font-weight: 800;
  font-family: 'Poppins', sans-serif;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 13px; color: var(--text-4); font-weight: 500; }
.stat-change { font-size: 12px; margin-top: 8px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ---- Avatar ---- */
.avatar {
  border-radius: var(--r-full);
  background: var(--gradient-brand);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* ---- Dropdown ---- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card-2, #1a2235);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  animation: fadeInDown 0.2s ease;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--t-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dropdown-item:hover { background: rgba(255,255,255,0.05); color: var(--text-1); }
.dropdown-item.danger:hover { background: rgba(239,68,68,0.1); color: #f87171; }

/* ---- Alert ---- */
.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }
.alert-danger  { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: #f87171; }
.alert-info    { background: rgba(99,102,241,0.1);  border: 1px solid rgba(99,102,241,0.3);  color: #a5b4fc; }
.alert-success { background: rgba(16,185,129,0.1);  border: 1px solid rgba(16,185,129,0.3);  color: #34d399; }

/* ---- Progress Bar ---- */
.progress { background: rgba(255,255,255,0.08); border-radius: var(--r-full); height: 6px; overflow: hidden; }
.progress-bar {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--r-full);
  animation: progressFill 1s ease both;
}

/* ---- Tag ---- */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 500;
  background: rgba(255,255,255,0.08);
  color: var(--text-3);
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-4);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: var(--text-3); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 24px; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.05); border-radius: var(--r-md); padding: 4px; }
.tab-btn {
  flex: 1;
  padding: 9px 16px;
  border: none;
  background: transparent;
  color: var(--text-3);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--t-base);
  font-family: inherit;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.tab-btn:hover:not(.active) { color: var(--text-1); background: rgba(255,255,255,0.05); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.3s ease; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .modal-content { border-radius: var(--r-lg); }
}
