/* assets/style.css */

/* ── Google Fonts ───────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Variables de tema ──────────────────────────────── */
:root,
[data-theme="light"] {
  --bg:          #f4f2ee;
  --surface:     #ffffff;
  --surface-2:   #f9f8f6;
  --border:      #e2ddd6;
  --accent:      #2a5fff;
  --accent-h:    #1a4de8;
  --text:        #1a1814;
  --text-muted:  #706b62;
  --danger:      #d94f3d;
  --success:     #2e8a57;
  --shadow:      0 2px 12px rgba(0,0,0,.07);
  --radius:      14px;
  --radius-sm:   8px;
}

[data-theme="dark"] {
  --bg:          #141210;
  --surface:     #1e1b18;
  --surface-2:   #252119;
  --border:      #312d27;
  --accent:      #4d78ff;
  --accent-h:    #6690ff;
  --text:        #f0ece4;
  --text-muted:  #9b9287;
  --danger:      #e8624f;
  --success:     #42c278;
  --shadow:      0 2px 16px rgba(0,0,0,.35);
}

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

html { font-size: 16px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background .3s, color .3s;
}

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

/* ── Auth pages ──────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 70% 20%, rgba(42,95,255,.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(42,95,255,.05) 0%, transparent 60%);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  box-shadow: var(--shadow);
  padding: 2.5rem 2.8rem;
  width: 100%;
  max-width: 420px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 2rem;
}

.brand-icon {
  font-size: 1.8rem;
  color: var(--accent);
}

.brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  color: var(--text);
}

.auth-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.75rem;
  font-weight: 400;
  margin-bottom: 1.6rem;
  color: var(--text);
}

/* ── Forms ───────────────────────────────────────────── */
.auth-form, .prefs-form { display: flex; flex-direction: column; gap: 1.1rem; }

.field { display: flex; flex-direction: column; gap: .4rem; }

.field label {
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field select {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .97rem;
  padding: .65rem 1rem;
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42,95,255,.15);
}

/* Select arrow */
.field 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='%23706b62' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* Checkbox */
.field-check { justify-content: center; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
  font-size: .95rem;
  color: var(--text);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: .97rem;
  font-weight: 600;
  padding: .75rem 1.5rem;
  margin-top: .4rem;
  transition: background .18s, transform .1s;
  letter-spacing: .02em;
}

.btn-primary:hover  { background: var(--accent-h); }
.btn-primary:active { transform: scale(.98); }

/* Auth switch */
.auth-switch {
  text-align: center;
  margin-top: 1.4rem;
  font-size: .9rem;
  color: var(--text-muted);
}

/* Alerts */
.alert {
  border-radius: var(--radius-sm);
  font-size: .9rem;
  padding: .75rem 1rem;
  margin-bottom: .8rem;
}

.alert-error {
  background: rgba(217,79,61,.1);
  border: 1px solid rgba(217,79,61,.3);
  color: var(--danger);
}

.alert-success {
  background: rgba(46,138,87,.1);
  border: 1px solid rgba(46,138,87,.3);
  color: var(--success);
}

/* ── Dashboard layout ────────────────────────────────── */
.dashboard-page {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.8rem 1.2rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .auth-brand { margin-bottom: 2.4rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: .3rem; flex: 1; }

.nav-item {
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  font-size: .9rem;
  font-weight: 500;
  gap: .7rem;
  padding: .6rem .9rem;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.nav-item:hover, .nav-item.active {
  background: rgba(42,95,255,.08);
  color: var(--accent);
  text-decoration: none;
}

.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.nav-logout {
  margin-top: auto;
  color: var(--danger);
}

.nav-logout:hover {
  background: rgba(217,79,61,.08);
  color: var(--danger);
}

/* Sidebar user */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem;
  margin-top: 1.5rem;
}

.avatar {
  background: var(--accent);
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-meta { display: flex; flex-direction: column; overflow: hidden; }
.user-name  { font-size: .85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main content */
.main-content {
  padding: 2.4rem 2.8rem;
  overflow-y: auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  font-weight: 400;
  color: var(--text);
}

.page-sub { color: var(--text-muted); font-size: .95rem; margin-top: .2rem; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  box-shadow: var(--shadow);
  transition: transform .15s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

/* Section card */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 1.4rem;
  color: var(--text);
}

/* Prefs grid */
.prefs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.4rem;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .dashboard-page {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .5rem;
    padding: 1rem;
  }
  .sidebar-nav { flex-direction: row; flex: unset; }
  .sidebar-user { display: none; }
  .main-content { padding: 1.4rem 1rem; }
  .auth-card { padding: 1.8rem 1.4rem; }
}
