/* File: public/css/main.css */
/* Design: Stripe-inspired — Purple gradients, weight-300 elegance, fintech precision */

:root {
  /* Brand */
  --primary: #635bff;
  --primary-hover: #5851ea;
  --primary-light: #7a73ff;
  --accent-gradient: linear-gradient(135deg, #635bff 0%, #a259ff 100%);

  /* Semantic */
  --success: #0ea371;
  --success-bg: #e6f9f0;
  --danger: #df1b41;
  --danger-bg: #fde8ed;
  --warning: #e5960a;
  --warning-bg: #fef5e0;
  --info: #0073e6;
  --info-bg: #e8f2fe;

  /* Neutral */
  --gray-25: #fafafa;
  --gray-50: #f6f8fa;
  --gray-100: #eef1f5;
  --gray-200: #d8dee4;
  --gray-300: #c1c8d0;
  --gray-400: #9aa2ac;
  --gray-500: #6b7385;
  --gray-600: #545b6b;
  --gray-700: #3c4257;
  --gray-800: #2a2f45;
  --gray-900: #1a1f36;

  /* Surfaces */
  --bg: #f6f8fa;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --border: #e3e8ee;
  --border-focus: #635bff;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  --text-primary: #1a1f36;
  --text-secondary: #6b7385;
  --text-tertiary: #9aa2ac;

  /* Spacing */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows (Stripe-style layered) */
  --shadow-sm: 0 1px 1px rgba(0,0,0,0.03), 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 2px 5px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-focus: 0 0 0 3px rgba(99, 91, 255, 0.15);
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   LAYOUT
   ============================================ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.page-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.page-header .logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header nav { display: flex; gap: 4px; align-items: center; }
.page-header nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.page-header nav a:hover {
  color: var(--primary);
  background: rgba(99, 91, 255, 0.06);
}
.page-header nav a.active {
  color: var(--primary);
  background: rgba(99, 91, 255, 0.08);
  font-weight: 600;
}

/* Header user info */
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.header-user-name {
  color: var(--text-primary);
  font-weight: 500;
}
.header-logout {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.header-logout:hover {
  color: var(--danger);
  background: rgba(223, 27, 65, 0.06);
}

.page-content {
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  transition: box-shadow 0.2s ease;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card .stat-value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================
   BUTTONS (Stripe-style)
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 2px rgba(99, 91, 255, 0.2), 0 1px 1px rgba(0,0,0,0.06);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 4px rgba(99, 91, 255, 0.3), 0 1px 2px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 1px 2px rgba(14, 163, 113, 0.2);
}
.btn-success:hover { filter: brightness(1.08); }

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 1px 2px rgba(223, 27, 65, 0.2);
}
.btn-danger:hover { filter: brightness(1.08); }

.btn-outline {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--gray-50);
  color: var(--text-primary);
}

.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-block { display: flex; width: 100%; }

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

/* ============================================
   FORMS (Stripe-style)
   ============================================ */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.form-input::placeholder { color: var(--text-tertiary); }

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

/* ============================================
   TABLES (Stripe-style clean)
   ============================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text-primary);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-25); }

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.tab {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ============================================
   BADGES (Stripe-style pill)
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.badge-success { background: var(--success-bg); color: #0a6847; }
.badge-warning { background: var(--warning-bg); color: #8a5a00; }
.badge-danger { background: var(--danger-bg); color: #b01030; }
.badge-info { background: var(--info-bg); color: #0055aa; }

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 12px 20px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-lg);
}

.toast-show { opacity: 1; transform: translateY(0); }
.toast-info { background: var(--primary); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--text-primary); }

/* ============================================
   AUTH PAGE (Gradient hero)
   ============================================ */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-900);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 91, 255, 0.3), transparent),
    radial-gradient(ellipse 60% 40% at 80% 50%, rgba(162, 89, 255, 0.15), transparent);
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.auth-card h1 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 14px;
  font-weight: 400;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}

.empty-state .icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { padding: 0 16px; }
  .page-header nav { gap: 0; }
  .page-header nav a { padding: 6px 8px; font-size: 13px; }
  .page-content { padding: 20px 16px; }
  .auth-card { margin: 16px; padding: 28px 24px; }
}
