/* ============================================================
   Smart Reminder — App CSS
   Design: Nexus palette, Satoshi font, clean minimal
   ============================================================ */

@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700&display=swap');

/* ---- DESIGN TOKENS ---------------------------------------- */
:root, [data-theme="light"] {
  --font-body: 'Satoshi', 'Inter', system-ui, sans-serif;

  --color-bg:              #f7f6f2;
  --color-surface:         #f9f8f5;
  --color-surface-2:       #ffffff;
  --color-surface-offset:  #f0ede8;
  --color-divider:         #dcd9d5;
  --color-border:          #d4d1ca;

  --color-text:            #28251d;
  --color-text-muted:      #6b6a65;
  --color-text-faint:      #b0aea9;
  --color-text-inverse:    #f9f8f4;

  --color-primary:         #01696f;
  --color-primary-hover:   #0c4e54;
  --color-primary-light:   #e6f3f3;
  --color-success:         #437a22;
  --color-success-light:   #eaf3e3;
  --color-warning:         #964219;
  --color-warning-light:   #fdf0e8;
  --color-error:           #b91c1c;
  --color-error-light:     #fef2f2;
  --color-info:            #006494;
  --color-info-light:      #e6f2f9;

  --radius-sm:  0.375rem;
  --radius-md:  0.5rem;
  --radius-lg:  0.75rem;
  --radius-xl:  1rem;
  --radius-full: 9999px;

  --space-1: 0.25rem; --space-2: 0.5rem;  --space-3: 0.75rem;
  --space-4: 1rem;    --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem;    --space-10: 2.5rem; --space-12: 3rem;
  --space-16: 4rem;

  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);

  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);

  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --sidebar-w: 260px;
  --header-h:  60px;
}

[data-theme="dark"] {
  --color-bg:              #171614;
  --color-surface:         #1c1b19;
  --color-surface-2:       #232220;
  --color-surface-offset:  #1d1c1a;
  --color-divider:         #2e2d2b;
  --color-border:          #3a3937;
  --color-text:            #cdccca;
  --color-text-muted:      #7a7976;
  --color-text-faint:      #4e4d4c;
  --color-text-inverse:    #2b2a28;
  --color-primary:         #4f98a3;
  --color-primary-hover:   #227f8b;
  --color-primary-light:   #1e3435;
  --color-success:         #6daa45;
  --color-success-light:   #233318;
  --color-warning:         #bb653b;
  --color-warning-light:   #362015;
  --color-error:           #f87171;
  --color-error-light:     #3b1a1a;
  --color-info:            #5591c7;
  --color-info-light:      #1a2d3d;
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #171614; --color-surface: #1c1b19; --color-surface-2: #232220;
    --color-surface-offset: #1d1c1a; --color-divider: #2e2d2b; --color-border: #3a3937;
    --color-text: #cdccca; --color-text-muted: #7a7976; --color-text-faint: #4e4d4c;
    --color-primary: #4f98a3; --color-primary-hover: #227f8b; --color-primary-light: #1e3435;
  }
}

/* ---- BASE ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); font-size: var(--text-base); color: var(--color-text); background: var(--color-bg); line-height: 1.6; min-height: 100dvh; }
img, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
h1,h2,h3,h4 { line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
::selection { background: oklch(from var(--color-primary) l c h / 0.2); }

/* ---- AUTH LAYOUT ------------------------------------------ */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: var(--space-4);
  background: radial-gradient(ellipse at 30% 20%, oklch(from var(--color-primary) l c h / 0.06) 0%, transparent 60%), var(--color-bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: var(--space-10) var(--space-8);
  box-shadow: var(--shadow-lg);
}
.auth-logo { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.auth-logo h1 { font-size: var(--text-lg); font-weight: 700; }
.auth-subtitle { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--space-6); }
.auth-footer { text-align: center; font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-6); }

/* ---- APP LAYOUT ------------------------------------------- */
.app-layout { display: flex; height: 100dvh; overflow: hidden; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--color-surface); border-right: 1px solid var(--color-divider);
  display: flex; flex-direction: column; overflow-y: auto;
  transition: transform var(--transition);
}
.sidebar-header {
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  display: flex; align-items: center; gap: var(--space-3);
}
.sidebar-logo-text { font-size: var(--text-sm); font-weight: 700; }
.sidebar-nav { padding: var(--space-3) var(--space-3); flex: 1; }
.nav-section-label {
  font-size: var(--text-xs); font-weight: 600; color: var(--color-text-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: var(--space-4) var(--space-3) var(--space-2);
}
.nav-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px; text-decoration: none;
}
.nav-link:hover { background: var(--color-surface-offset); color: var(--color-text); text-decoration: none; }
.nav-link.active { background: var(--color-primary-light); color: var(--color-primary); }
.nav-link svg { flex-shrink: 0; opacity: 0.7; }
.nav-link.active svg { opacity: 1; }
.sidebar-footer { padding: var(--space-4); border-top: 1px solid var(--color-divider); }
.user-pill {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
  background: var(--color-surface-offset);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: var(--color-primary-light); color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 700; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-phone { font-size: var(--text-xs); color: var(--color-text-muted); }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-header {
  height: var(--header-h); padding: 0 var(--space-6);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--color-surface-2); border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}
.main-header h2 { font-size: var(--text-lg); font-weight: 600; }
.page-body { flex: 1; overflow-y: auto; padding: var(--space-6); }

/* ---- CARDS ----------------------------------------------- */
.card {
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-body { padding: var(--space-5); }
.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: var(--text-base); font-weight: 600; }

/* ---- STATS GRID ------------------------------------------ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.stat-card { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); }
.stat-label { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-2); }
.stat-value { font-size: var(--text-xl); font-weight: 700; line-height: 1; }
.stat-sub { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }

/* ---- BUTTONS --------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--color-primary); color: var(--color-text-inverse); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-ghost { color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-surface-offset); color: var(--color-text); }
.btn-danger { background: var(--color-error-light); color: var(--color-error); }
.btn-danger:hover { background: var(--color-error); color: white; }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: var(--space-2); border-radius: var(--radius-md); }

/* ---- FORMS ----------------------------------------------- */
.auth-form, .form { display: flex; flex-direction: column; gap: var(--space-4); }
.form-group { display: flex; flex-direction: column; gap: var(--space-1); }
.form-group label { font-size: var(--text-sm); font-weight: 500; }
.form-control {
  width: 100%; padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); font-size: var(--text-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.12); }
.form-hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

/* ---- OTP INPUTS ------------------------------------------ */
.otp-inputs { display: flex; gap: var(--space-2); justify-content: center; margin-bottom: var(--space-4); }
.otp-input {
  width: 48px; height: 56px; text-align: center;
  font-size: var(--text-lg); font-weight: 700;
  background: var(--color-surface-offset); border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.otp-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.12); }

/* ---- ALERTS ---------------------------------------------- */
.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); margin-bottom: var(--space-4); }
.alert-error   { background: var(--color-error-light);   color: var(--color-error); }
.alert-success { background: var(--color-success-light); color: var(--color-success); }
.alert-info    { background: var(--color-info-light);    color: var(--color-info); }
.alert-warning { background: var(--color-warning-light); color: var(--color-warning); }

/* ---- BADGES ---------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 600; }
.badge-active  { background: var(--color-success-light); color: var(--color-success); }
.badge-paused  { background: var(--color-warning-light); color: var(--color-warning); }
.badge-done    { background: var(--color-surface-offset); color: var(--color-text-muted); }
.badge-web     { background: var(--color-info-light); color: var(--color-info); }
.badge-wa      { background: #e8f5e9; color: #2e7d32; }

/* ---- REMINDER LIST --------------------------------------- */
.reminder-list { display: flex; flex-direction: column; gap: var(--space-3); }
.reminder-item {
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5);
  display: flex; align-items: flex-start; gap: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.reminder-item:hover { box-shadow: var(--shadow-md); }
.reminder-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-primary-light); color: var(--color-primary);
}
.reminder-icon.paused { background: var(--color-warning-light); color: var(--color-warning); }
.reminder-icon.done   { background: var(--color-surface-offset); color: var(--color-text-muted); }
.reminder-body { flex: 1; min-width: 0; }
.reminder-title { font-weight: 600; margin-bottom: var(--space-1); }
.reminder-meta { font-size: var(--text-xs); color: var(--color-text-muted); display: flex; flex-wrap: wrap; gap: var(--space-3); }
.reminder-actions { display: flex; gap: var(--space-1); align-items: flex-start; flex-shrink: 0; }

/* ---- EMPTY STATE ----------------------------------------- */
.empty-state { text-align: center; padding: var(--space-16) var(--space-8); color: var(--color-text-muted); }
.empty-state svg { margin: 0 auto var(--space-4); opacity: 0.3; }
.empty-state h3 { font-size: var(--text-lg); color: var(--color-text); margin-bottom: var(--space-2); }
.empty-state p { font-size: var(--text-sm); margin-bottom: var(--space-6); }

/* ---- MODAL ----------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: oklch(0.1 0 0 / 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: var(--space-4); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity var(--transition);
  pointer-events: none;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px); transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: var(--text-base); font-weight: 600; }
.modal-body { padding: var(--space-6); }
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-divider);
  display: flex; justify-content: flex-end; gap: var(--space-3);
}

/* ---- FILTER TABS ----------------------------------------- */
.filter-tabs { display: flex; gap: var(--space-1); background: var(--color-surface-offset); border-radius: var(--radius-full); padding: var(--space-1); width: fit-content; }
.filter-tab { padding: var(--space-1) var(--space-4); border-radius: var(--radius-full); font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted); transition: all var(--transition); cursor: pointer; border: none; background: none; }
.filter-tab.active { background: var(--color-surface-2); color: var(--color-text); box-shadow: var(--shadow-sm); }

/* ---- MOBILE RESPONSIVE ----------------------------------- */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; width: 260px; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; background: oklch(0 0 0 / 0.4); z-index: 49; display: none; }
  .sidebar.open + .sidebar-backdrop { display: block; }
  .menu-toggle { display: flex !important; }
  .page-body { padding: var(--space-4); }
  .form-row { grid-template-columns: 1fr; }
}
.menu-toggle { display: none; }

/* ---- SCROLLBAR ------------------------------------------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }

/* ---- THEME TOGGLE ---------------------------------------- */
.theme-toggle { padding: var(--space-2); border-radius: var(--radius-md); color: var(--color-text-muted); transition: background var(--transition), color var(--transition); }
.theme-toggle:hover { background: var(--color-surface-offset); color: var(--color-text); }

/* ---- TOPBAR ACTIONS -------------------------------------- */
.header-actions { display: flex; align-items: center; gap: var(--space-2); }

/* ---- TODAY HIGHLIGHT ------------------------------------- */
.today-section { margin-bottom: var(--space-6); }
.today-section h3 { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); margin-bottom: var(--space-3); text-transform: uppercase; letter-spacing: 0.05em; }
