/* ==========================================================================
   Nomi Share — styles
   --------------------------------------------------------------------------
   Independent web app styles for the /share workspace overview. Token blocks
   are copied verbatim from css/styles.css (:root + [data-theme="dark"]) so the
   share view matches the main product exactly. Component styles below are
   share-specific. No colors are hard-coded — everything reads from tokens.
   ========================================================================== */

/* ---- Design tokens (mirror of css/styles.css) ------------------------- */
:root {
  /* Neutrals */
  --bg-app: #FAFAFA;
  --bg-surface: #FFFFFF;
  --bg-muted: #F2F2F3;
  --bg-hover: rgba(66,133,244,.08);
  /* Text */
  --text-primary: #202124;
  --text-secondary: #5F6368;
  --text-tertiary: #9AA0A6;
  /* Accent */
  --accent-blue: #4285F4;
  --accent-purple: #7C4DFF;
  --accent-gradient: linear-gradient(135deg, #4285F4, #7C4DFF);
  /* Semantic */
  --success: #34A853; --warning: #FBBC05; --danger: #EA4335;
  /* Borders */
  --border-light: rgba(0,0,0,.06);
  --border-default: rgba(0,0,0,.08);
  --border-focus: rgba(66,133,244,.5);
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  --shadow-xl: 0 20px 60px rgba(0,0,0,.16), 0 8px 20px rgba(0,0,0,.08);
  --shadow-focus: 0 0 0 4px rgba(66,133,244,.15);
  /* Radii */
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 20px; --radius-full: 50%;
  /* Spacing (8px grid) */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  /* Typography */
  --font-family: 'Inter', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-sm: .75rem; --font-base: .875rem; --font-md: 1rem; --font-lg: 1.125rem; --font-xl: 1.375rem;
  /* Transitions */
  --transition-fast: 200ms cubic-bezier(.2, 0, 0, 1);
  --transition-normal: 250ms cubic-bezier(.2, 0, 0, 1);
}

[data-theme="dark"] {
  --bg-app: #1A1A2E;
  --bg-surface: #1E1E32;
  --bg-muted: #2A2A42;
  --bg-hover: rgba(138,180,248,.1);
  --bg-tertiary: #252540;
  --text-primary: #E8E8ED;
  --text-secondary: #A0A0B8;
  --text-tertiary: #6C6C88;
  --accent-blue: #8AB4F8;
  --accent-purple: #B388FF;
  --accent-gradient: linear-gradient(135deg, #8AB4F8, #B388FF);
  --success: #81C995; --warning: #FDD633; --danger: #F28B82;
  --border-light: rgba(255,255,255,.06);
  --border-default: rgba(255,255,255,.08);
}

/* ---- Base -------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-family);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: var(--font-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }

/* RTL: Nomi share UI is Persian-first. [dir="rtl"] handled by html attribute. */
[dir="rtl"] .ltr-flip { transform: scaleX(-1); }

/* ---- App shell --------------------------------------------------------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }

/* Centered card container (auth + code entry) */
.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background:
    radial-gradient(1200px 600px at 100% 0, rgba(124,77,255,.08), transparent 60%),
    radial-gradient(1000px 500px at 0 100%, rgba(66,133,244,.08), transparent 60%);
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 420px;
}
.card.wide { max-width: 560px; }

.brand {
  display: flex; align-items: center; gap: var(--space-3);
  justify-content: center; margin-bottom: var(--space-6);
}
.brand-mark {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: var(--font-lg);
  box-shadow: var(--shadow-md);
}
.brand-name { font-size: var(--font-xl); font-weight: 700; letter-spacing: -.02em; }

h1, h2 { letter-spacing: -.02em; }
.card h1 { font-size: var(--font-lg); text-align: center; margin-bottom: var(--space-2); }
.card .subtitle {
  color: var(--text-secondary); text-align: center;
  font-size: var(--font-base); margin-bottom: var(--space-6);
}

/* ---- Forms ------------------------------------------------------------- */
.field { margin-bottom: var(--space-4); }
.field label {
  display: block; font-size: var(--font-sm); font-weight: 600;
  color: var(--text-secondary); margin-bottom: var(--space-2);
}
.input {
  width: 100%; padding: 12px 16px;
  font-size: var(--font-md); font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input:focus { outline: none; border-color: var(--accent-blue); box-shadow: var(--shadow-focus); }
.input::placeholder { color: var(--text-tertiary); }
.input.code-input {
  text-align: center; letter-spacing: .15em; font-weight: 700; text-transform: uppercase;
}

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: .8125rem; font-weight: 600; line-height: 1;
  border: none; border-radius: var(--radius-sm);
  background: var(--bg-muted); color: var(--text-primary);
  transition: all var(--transition-fast);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #3B78E7; }
.btn-secondary { background: var(--bg-muted); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); box-shadow: none; transform: none; }
.btn-block { width: 100%; }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--font-sm); }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Alerts ------------------------------------------------------------ */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  margin-bottom: var(--space-4);
  animation: fade-in var(--transition-fast);
}
.alert-danger { background: rgba(234,67,53,.1); color: var(--danger); border: 1px solid rgba(234,67,53,.25); }
.alert-success { background: rgba(52,168,83,.1); color: var(--success); border: 1px solid rgba(52,168,83,.25); }
.alert-info { background: var(--bg-hover); color: var(--accent-blue); }
@keyframes fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---- Overview shell ---------------------------------------------------- */
.overview {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.share-header {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 10;
}
.owner-info { display: flex; align-items: center; gap: var(--space-3); }
.avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  background: var(--accent-gradient); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: var(--font-base);
  overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.owner-meta .name { font-weight: 600; font-size: var(--font-base); }
.owner-meta .sub { font-size: var(--font-sm); color: var(--text-tertiary); }

.shared-badge-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--font-sm); padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(124,77,255,.12); color: var(--accent-purple);
  font-weight: 600;
}

.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: var(--space-2); }

/* Sidebar */
.sidebar {
  background: var(--bg-surface);
  border-inline-end: 1px solid var(--border-light);
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
}
.nav-section-label {
  font-size: var(--font-sm); color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: .06em;
  padding: var(--space-3) var(--space-3) var(--space-2);
}
.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); width: 100%;
  border: none; background: transparent; color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--font-base); font-weight: 500; text-align: start;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-hover); color: var(--accent-blue); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .perm-tag {
  margin-inline-start: auto;
  font-size: 10px; padding: 1px 6px; border-radius: var(--radius-full);
  background: var(--bg-muted); color: var(--text-tertiary); font-weight: 600;
}
.nav-item .perm-tag.collab { background: rgba(124,77,255,.15); color: var(--accent-purple); }

/* Main content */
.content {
  padding: var(--space-8) var(--space-8) 120px;
  overflow-y: auto;
  max-width: 100%;
}
.content-header { margin-bottom: var(--space-6); }
.content-header h2 { font-size: var(--font-xl); margin-bottom: var(--space-1); }
.content-header p { color: var(--text-secondary); font-size: var(--font-base); }

/* ---- List view (tasks) ------------------------------------------------- */
.list-grid { display: grid; gap: var(--space-4); }
.list-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.list-card-head {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
}
.list-card-body { padding: var(--space-2); }
.task-row {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-sm);
}
.task-row:hover { background: var(--bg-hover); }
.checkbox {
  width: 18px; height: 18px; border-radius: 4px;
  border: 2px solid var(--border-default); flex-shrink: 0; margin-top: 1px;
  display: grid; place-items: center; cursor: pointer;
}
.checkbox.checked { background: var(--success); border-color: var(--success); color: #fff; }
.task-text { flex: 1; font-size: var(--font-base); }
.task-text.done { color: var(--text-tertiary); text-decoration: line-through; }
.empty-state {
  padding: var(--space-10); text-align: center; color: var(--text-tertiary);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: var(--space-4); opacity: .5; }

/* ---- Shared attribution badge ----------------------------------------- */
.shared-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-purple); color: #fff;
  font-weight: 600;
}
.shared-badge svg { width: 11px; height: 11px; }

/* ---- Today view -------------------------------------------------------- */
.today-intention {
  background: var(--accent-gradient); color: #fff;
  padding: var(--space-6); border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}
.today-intention .label { font-size: var(--font-sm); opacity: .85; margin-bottom: var(--space-1); }
.today-intention .text { font-size: var(--font-md); font-weight: 600; }

/* ---- Install-CTA banner (sticky bottom) ------------------------------- */
.cta-banner {
  position: fixed; bottom: 0; inset-inline: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
  padding: var(--space-4) var(--space-8);
  display: flex; align-items: center; gap: var(--space-4);
  z-index: 20;
}
.cta-banner .cta-text { flex: 1; }
.cta-banner .cta-text strong { display: block; font-size: var(--font-base); }
.cta-banner .cta-text span { font-size: var(--font-sm); color: var(--text-secondary); }
.cta-banner .btn-primary { background: var(--accent-gradient); }

/* ---- Utilities --------------------------------------------------------- */
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: var(--space-2); }
.row.between { justify-content: space-between; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.text-sm { font-size: var(--font-sm); color: var(--text-secondary); }
.divider { height: 1px; background: var(--border-light); margin: var(--space-4) 0; }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 720px) {
  .overview { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 10;
    border-inline-end: none; border-bottom: 1px solid var(--border-light);
    display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-2);
  }
  .nav-section-label { display: none; }
  .nav-item { white-space: nowrap; }
  .nav-item .perm-tag { display: none; }
  .content { padding: var(--space-4) var(--space-4) 140px; }
  .cta-banner { flex-direction: column; align-items: stretch; gap: var(--space-2); padding: var(--space-3) var(--space-4); }
}
/* Zoom up to 200% / large text: keep layout from breaking. */
@media (min-resolution: 1.5dppx) {
  .content { max-width: 1100px; margin-inline: auto; }
}
