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

/* ============================================================
   THEMES — each [data-theme] overrides the variable palette.
   :root holds the default (violet) so unthemed pages still work.
   ============================================================ */
:root,
[data-theme="violet"] {
  --bg: #0f0f13;
  --bg-glow: rgba(124, 106, 247, 0.14);
  --surface: #17171f;
  --surface2: #20202c;
  --border: #2c2c3a;
  --accent: #7c6af7;
  --accent-2: #b06af7;
  --accent-hover: #9b8df9;
  --text: #e8e8f0;
  --text-muted: #8a8aa6;
  --on-accent: #ffffff;
}
[data-theme="ocean"] {
  --bg: #0b1320;
  --bg-glow: rgba(58, 160, 255, 0.16);
  --surface: #111c2c;
  --surface2: #18283c;
  --border: #233347;
  --accent: #3aa0ff;
  --accent-2: #36d6e0;
  --accent-hover: #5cb3ff;
  --text: #e6eef8;
  --text-muted: #7d93ad;
  --on-accent: #04121f;
}
[data-theme="forest"] {
  --bg: #0c130f;
  --bg-glow: rgba(63, 207, 142, 0.15);
  --surface: #111c16;
  --surface2: #18271e;
  --border: #233528;
  --accent: #3fcf8e;
  --accent-2: #8fd94a;
  --accent-hover: #5cdaa1;
  --text: #e6f2ea;
  --text-muted: #7ba089;
  --on-accent: #042014;
}
[data-theme="sunset"] {
  --bg: #170f12;
  --bg-glow: rgba(255, 122, 89, 0.16);
  --surface: #20151a;
  --surface2: #2c1d22;
  --border: #3a2730;
  --accent: #ff7a59;
  --accent-2: #ff5ca0;
  --accent-hover: #ff9377;
  --text: #f6e9e8;
  --text-muted: #b08e8a;
  --on-accent: #1f0a06;
}
[data-theme="rose"] {
  --bg: #140e16;
  --bg-glow: rgba(247, 106, 166, 0.16);
  --surface: #1d141f;
  --surface2: #281b2b;
  --border: #382539;
  --accent: #f76aa6;
  --accent-2: #b06af7;
  --accent-hover: #f98abb;
  --text: #f3e8f0;
  --text-muted: #a888a0;
  --on-accent: #1d0613;
}
[data-theme="mono"] {
  --bg: #0e0e10;
  --bg-glow: rgba(200, 200, 214, 0.08);
  --surface: #18181b;
  --surface2: #222226;
  --border: #2e2e34;
  --accent: #c9c9d6;
  --accent-2: #9a9aa8;
  --accent-hover: #e0e0ea;
  --text: #e8e8ec;
  --text-muted: #85858f;
  --on-accent: #111113;
}
[data-theme="light"] {
  --bg: #f4f4f8;
  --bg-glow: rgba(124, 106, 247, 0.12);
  --surface: #ffffff;
  --surface2: #eef0f5;
  --border: #dfe1ea;
  --accent: #6c5af0;
  --accent-2: #a05af0;
  --accent-hover: #5a47e0;
  --text: #1c1c28;
  --text-muted: #6a6a82;
  --on-accent: #ffffff;
}

:root {
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 0 1px var(--border), 0 10px 40px -12px var(--bg-glow);
}

html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(60% 40% at 50% -5%, var(--bg-glow), transparent 70%),
    radial-gradient(40% 30% at 100% 0%, var(--bg-glow), transparent 60%);
  background-attachment: fixed;
  transition: background-color 0.3s, color 0.3s;
}

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

.gradient-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* NAV */
nav {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: 0.9rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, color 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  box-shadow: 0 6px 18px -8px var(--accent);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -8px var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-danger { background: transparent; color: #e05c7a; border: 1px solid color-mix(in srgb, #e05c7a 50%, transparent); }
.btn-danger:hover { background: #e05c7a; color: #fff; }
.btn-google { background: #fff; color: #333; border: 1px solid #ddd; }
.btn-google:hover { background: #f5f5f5; color: #333; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* FORMS */
.form-group { margin-bottom: 1.1rem; }
label { display: block; margin-bottom: 0.35rem; font-size: 0.85rem; color: var(--text-muted); }
input, textarea, select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea { resize: vertical; min-height: 80px; }

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-glow);
}

/* AUTH PAGES */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 62px); padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 0.25rem; letter-spacing: -0.5px; }
.auth-card .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.2rem 0; color: var(--text-muted); font-size: 0.8rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-footer { text-align: center; margin-top: 1.2rem; font-size: 0.85rem; color: var(--text-muted); }

/* DASHBOARD */
.dashboard { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.dashboard-header h1 { font-size: 1.7rem; letter-spacing: -0.5px; }

/* PORTFOLIO GRID */
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.4rem; }
.portfolio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.portfolio-card:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  transform: translateY(-3px);
  box-shadow: 0 14px 40px -16px var(--bg-glow);
}
.portfolio-card-preview {
  height: 140px;
  background:
    radial-gradient(80% 80% at 50% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent),
    var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-bottom: 1px solid var(--border);
}
.portfolio-card-body { padding: 1.1rem; flex: 1; display: flex; flex-direction: column; }
.portfolio-card-title { font-weight: 600; margin-bottom: 0.3rem; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portfolio-card-desc { font-size: 0.82rem; color: var(--text-muted); flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.portfolio-card-meta { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.75rem; flex-wrap: wrap; }
.badge { font-size: 0.72rem; padding: 0.18rem 0.55rem; border-radius: 6px; font-weight: 600; }
.badge-html { background: color-mix(in srgb, #3fcf8e 18%, transparent); color: #3fcf8e; }
.badge-pdf { background: color-mix(in srgb, #e05c7a 18%, transparent); color: #e05c7a; }
.badge-private { background: color-mix(in srgb, #c8c04a 18%, transparent); color: #c8c04a; }
.portfolio-card-actions { display: flex; gap: 0.5rem; padding: 0.85rem 1.1rem; border-top: 1px solid var(--border); }

/* MODALS */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 480px;
  padding: 1.85rem;
  box-shadow: var(--shadow);
  transform: translateY(8px) scale(0.99);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-header h2 { font-size: 1.2rem; letter-spacing: -0.3px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 0.25rem; }
.modal-close:hover { color: var(--text); }

/* DROP ZONE */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1rem;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.drop-zone-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.drop-zone-text { color: var(--text-muted); font-size: 0.85rem; }
.drop-zone-text strong { color: var(--accent); }
#file-input { display: none; }
.file-chosen { font-size: 0.8rem; color: #3fcf8e; margin-top: 0.4rem; }

/* HERO */
.hero { text-align: center; padding: 6.5rem 1rem 4rem; }
.hero h1 { font-size: clamp(2.2rem, 6.5vw, 4rem); font-weight: 800; letter-spacing: -1.5px; margin-bottom: 1.2rem; line-height: 1.05; }
.hero p { font-size: 1.12rem; color: var(--text-muted); max-width: 560px; margin: 0 auto 2.2rem; }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.hero-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
}

/* FEATURES */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.4rem; max-width: 940px; margin: 0 auto 5rem; padding: 0 1rem; }
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  transition: transform 0.2s, border-color 0.2s;
}
.feature-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.feature-icon { font-size: 1.9rem; margin-bottom: 0.85rem; }
.feature-card h3 { font-size: 1.02rem; margin-bottom: 0.4rem; }
.feature-card p { font-size: 0.85rem; color: var(--text-muted); }

/* ALERT */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 1rem; }
.alert-error { background: color-mix(in srgb, #e05c7a 12%, transparent); border: 1px solid color-mix(in srgb, #e05c7a 35%, transparent); color: #e05c7a; }
.alert-success { background: color-mix(in srgb, #3fcf8e 12%, transparent); border: 1px solid color-mix(in srgb, #3fcf8e 35%, transparent); color: #3fcf8e; }

/* PROFILE PAGE */
.profile-page { max-width: 900px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.profile-header { display: flex; gap: 1.5rem; align-items: flex-start; margin-bottom: 2.2rem; flex-wrap: wrap; }
.profile-avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: var(--on-accent);
  flex-shrink: 0; overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info h1 { font-size: 1.6rem; margin-bottom: 0.25rem; letter-spacing: -0.5px; }
.profile-info p { color: var(--text-muted); font-size: 0.9rem; }

/* SETTINGS */
.settings-page { max-width: 760px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.settings-page h1 { font-size: 1.7rem; letter-spacing: -0.5px; margin-bottom: 0.3rem; }
.avatar-settings { display: flex; align-items: center; gap: 1.3rem; }
.avatar-settings .profile-avatar { width: 88px; height: 88px; font-size: 2.3rem; }
.avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.settings-page .page-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }
.settings-section { margin-bottom: 2.2rem; }
.settings-section h2 { font-size: 1.05rem; margin-bottom: 1rem; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.9rem; }
.theme-option {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  cursor: pointer;
  background: var(--surface2);
  transition: border-color 0.15s, transform 0.15s;
}
.theme-option:hover { transform: translateY(-2px); }
.theme-option.selected { border-color: var(--accent); }
.theme-option.selected::after {
  content: '✓';
  position: absolute; top: 6px; right: 9px;
  font-size: 0.8rem; font-weight: 700;
  color: var(--accent);
}
.theme-swatch { display: flex; height: 42px; border-radius: 6px; overflow: hidden; margin-bottom: 0.6rem; border: 1px solid var(--border); }
.theme-swatch span { flex: 1; }
.theme-name { font-size: 0.85rem; font-weight: 600; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { color: var(--text); margin-bottom: 0.5rem; }

/* TOAST */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.25rem;
  font-size: 0.875rem;
  z-index: 999;
  box-shadow: var(--shadow);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.toast-success { border-color: color-mix(in srgb, #3fcf8e 45%, var(--border)); }
.toast.toast-error { border-color: color-mix(in srgb, #e05c7a 45%, var(--border)); }

/* SPINNER */
.spinner { width: 18px; height: 18px; border: 2px solid color-mix(in srgb, var(--on-accent) 35%, transparent); border-top-color: var(--on-accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.views { font-size: 0.75rem; color: var(--text-muted); }

@media (max-width: 600px) {
  .dashboard-header { flex-direction: column; align-items: flex-start; }
  nav { padding: 0 1rem; }
}
