/* ═══════════════════════════════════════════════════════════
   PGBudget — Main CSS Design System
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --brand-600: #4F46E5;
  --brand-700: #4338CA;
  --brand-800: #3730A3;
  --brand-500: #6366F1;
  --brand-400: #818CF8;
  --brand-100: #EEF2FF;

  /* Accent */
  --accent-400: #6EE7B7;
  --accent-500: #34D399;
  --accent-600: #10B981;

  /* Neutrals */
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Semantics */
  --success-bg:   #ECFDF5;
  --success-text: #065F46;
  --success-border:#A7F3D0;
  --error-bg:     #FEF2F2;
  --error-text:   #991B1B;
  --error-border: #FECACA;
  --warning-bg:   #FFFBEB;
  --warning-text: #92400E;

  /* Sidebar */
  --sidebar-w: 260px;
  --sidebar-bg: #0F0F23;
  --sidebar-border: rgba(255,255,255,0.06);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.25);

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transition */
  --tr: 0.2s ease;
  --tr-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; scrollbar-width: thin; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--tr);
  box-shadow: 0 4px 14px rgba(79,70,229,0.35);
  white-space: nowrap;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-800));
  box-shadow: 0 6px 20px rgba(79,70,229,0.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }
.btn-primary svg { width: 16px; height: 16px; }

.btn-full { width: 100%; justify-content: center; padding: 13px 20px; font-size: 1rem; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: transparent;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--tr);
}
.btn-ghost:hover { background: var(--gray-100); border-color: var(--gray-300); color: var(--gray-800); }
.btn-ghost svg { width: 15px; height: 15px; }

.btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; background: #EF4444; color: #fff;
  border: none; border-radius: var(--radius); font-size: 0.875rem;
  font-weight: 600; font-family: inherit; cursor: pointer;
  transition: all var(--tr);
}
.btn-danger:hover { background: #DC2626; transform: translateY(-1px); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  letter-spacing: 0.01em;
}

.form-input {
  width: 100%;
  padding: 7px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  transition: all var(--tr);
  outline: none;
}
.form-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-input::placeholder { color: var(--gray-400); }

.has-error .form-input {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.field-error {
  font-size: 0.75rem;
  color: #EF4444;
  font-weight: 500;
}

.required { color: #EF4444; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.form-group-check { flex-direction: row; align-items: center; gap: 10px; }
.check-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 0.9rem; font-weight: 500; color: var(--gray-700);
}
.form-checkbox {
  width: 18px; height: 18px;
  accent-color: var(--brand-600);
  cursor: pointer;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; margin-bottom: 20px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-error { background: var(--error-bg); color: var(--error-text); border: 1px solid var(--error-border); }

/* ── Toasts ───────────────────────────────────────────────── */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform var(--tr-slow);
  min-width: 280px; max-width: 400px;
}
.toast.show { transform: translateX(0); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast-success { background: #fff; color: var(--success-text); border-left: 4px solid var(--accent-500); }
.toast-error   { background: #fff; color: var(--error-text); border-left: 4px solid #EF4444; }
.toast-warning { background: #fff; color: var(--warning-text); border-left: 4px solid #F59E0B; }

/* ── Spinner ──────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 20px; height: 20px; animation: spin 1s linear infinite; }
.spinner-sm { width: 16px; height: 16px; animation: spin 1s linear infinite; }

/* ── Input Wrapper (icon inside input) ────────────────────── */
.input-wrapper {
  position: relative;
  display: flex; align-items: center;
}
.input-wrapper .form-input { padding-left: 42px; }
.input-icon {
  position: absolute; left: 13px;
  width: 18px; height: 18px;
  color: var(--gray-400);
  pointer-events: none;
}
.toggle-password {
  position: absolute; right: 12px;
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); padding: 4px;
  display: flex; align-items: center;
  transition: color var(--tr);
}
.toggle-password:hover { color: var(--gray-600); }
.toggle-password svg { width: 18px; height: 18px; }

/* ── Rows animation ───────────────────────────────────────── */
@keyframes rowIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.row-animate { animation: rowIn 0.25s ease; }
