/* ═══════════════════════════════════════════════════════════════════════
   Ventify Partner Platform — Design System
   shadcn-style + Ventify brand colors + dark/light mode
   ═══════════════════════════════════════════════════════════════════════ */

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

:root {
  /* ── Ventify Brand ── */
  --coral: #ea6a50;
  --coral-light: #f08070;
  --coral-dark: #d85a40;
  --teal: #5d7c89;
  --brown: #745148;

  /* ── Light Mode (default) ── */
  --bg: #f5f5f7;
  --bg-surface: #ffffff;
  --bg-surface-hover: #fafafa;
  --bg-muted: #f1f5f9;
  --bg-accent: rgba(234, 106, 80, 0.08);
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --text: #1a2332;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --ring: rgba(234, 106, 80, 0.3);

  /* ── Semantic ── */
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  /* ── Spacing & Sizing ── */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --sidebar-width: 260px;
  --header-height: 64px;

  /* ── Typography ── */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "JetBrains Mono", monospace;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-hover: #253347;
  --bg-muted: #1e293b;
  --bg-accent: rgba(234, 106, 80, 0.12);
  --border: #334155;
  --border-hover: #475569;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5);
  --ring: rgba(248, 113, 113, 0.4);
  --coral: #f87171;
  --coral-light: #fca5a5;
  --coral-dark: #ef4444;
  --success-bg: #052e16;
  --warning-bg: #422006;
  --error-bg: #450a0a;
  --info-bg: #172554;
}

/* ── Base ── */
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--coral); color: white; border-color: var(--coral-dark);
}
.btn-primary:hover:not(:disabled) { background: var(--coral-dark); }

.btn-secondary {
  background: var(--bg-surface); color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-surface-hover); border-color: var(--border-hover); }

.btn-ghost {
  background: transparent; color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-muted); }

.btn-danger {
  background: var(--error); color: white; border-color: #dc2626;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-sm { padding: 5px 10px; font-size: 0.8125rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; }

/* ── Inputs ── */
.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg-surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.875rem; font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--ring);
}
.input::placeholder { color: var(--text-muted); }
.textarea { min-height: 80px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }

/* ── Cards ── */
.card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-header { margin-bottom: 16px; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.card-description { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 9999px;
  font-size: 0.75rem; font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.badge-error { background: var(--error-bg); color: var(--error); border-color: var(--error); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.badge-neutral { background: var(--bg-muted); color: var(--text-muted); border-color: var(--border); }

/* ── Table ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead { background: var(--bg-muted); }
th { padding: 10px 16px; text-align: left; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-surface-hover); }

/* ── Layout ── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width); background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 30;
}
.sidebar-logo {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo img { height: 32px; }
.sidebar-logo span { font-weight: 600; font-size: 1rem; color: var(--text); }

.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius);
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--bg-accent); color: var(--coral); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-section { padding: 8px 14px 4px; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--coral); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.875rem;
}

.main { margin-left: var(--sidebar-width); min-height: 100vh; }

.topbar {
  height: var(--header-height); padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 1.125rem; font-weight: 600; }

.content { padding: 32px; max-width: 1280px; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.stat-label { font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 1.75rem; font-weight: 700; margin-top: 4px; color: var(--text); }
.stat-change { font-size: 0.8125rem; margin-top: 4px; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--error); }

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 24px;
  max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
}
.modal-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── Toast ── */
.toast {
  position: fixed; top: 20px; right: 20px;
  padding: 12px 20px; border-radius: var(--radius);
  background: var(--bg-surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 100;
  font-size: 0.875rem; max-width: 400px;
  animation: slideIn 0.2s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Code block ── */
.code {
  font-family: var(--font-mono); font-size: 0.8125rem;
  background: var(--bg-muted); padding: 2px 6px;
  border-radius: 4px; color: var(--coral);
}
.code-block {
  font-family: var(--font-mono); font-size: 0.8125rem;
  background: var(--bg-muted); padding: 16px;
  border-radius: var(--radius); border: 1px solid var(--border);
  overflow-x: auto; white-space: pre;
  line-height: 1.5;
}

/* ── Theme toggle ── */
.theme-toggle {
  background: none; border: none; cursor: pointer;
  padding: 8px; border-radius: var(--radius);
  color: var(--text-muted);
}
.theme-toggle:hover { background: var(--bg-muted); color: var(--text); }

/* ── Lang toggle ── */
.lang-toggle {
  font-size: 0.8125rem; padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted); color: var(--text-secondary);
  border: 1px solid var(--border); cursor: pointer;
}
.lang-toggle:hover { border-color: var(--border-hover); }

/* ── Login page ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 100%; max-width: 420px; padding: 40px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 40px; margin-bottom: 12px; }
.login-logo h1 { font-size: 1.25rem; font-weight: 600; color: var(--text); }
.login-logo p { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form .btn { width: 100%; justify-content: center; margin-top: 8px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Transitions ── */
.fade-in { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Skeleton loading ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-surface-hover) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
