/* ============================================================
   Viber Design System — v1.0
   Token palette adapted from Anthropic Claude DESIGN.md
   Free font fallbacks: Georgia (serif display), Inter (sans body)
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* ---- Colors ---- */
  --primary: #cc785c;
  --primary-active: #a9583e;
  --primary-disabled: #e6dfd8;
  --ink: #141413;
  --body: #3d3d3a;
  --body-strong: #252523;
  --muted: #6c6a64;
  --muted-soft: #8e8b82;
  --hairline: #e6dfd8;
  --hairline-soft: #ebe6df;
  --canvas: #faf9f5;
  --surface-soft: #f5f0e8;
  --surface-card: #efe9de;
  --surface-cream-strong: #e8e0d2;
  --surface-dark: #181715;
  --surface-dark-elevated: #252320;
  --surface-dark-soft: #1f1e1b;
  --on-primary: #ffffff;
  --on-dark: #faf9f5;
  --on-dark-soft: #a09d96;
  --accent-teal: #5db8a6;
  --accent-amber: #e8a55a;
  --success: #5db872;
  --warning: #d4a017;
  --error: #c64545;

  /* ---- Typography ---- */
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: Inter, "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;

  --text-display-xl: 64px;
  --text-display-lg: 48px;
  --text-display-md: 36px;
  --text-display-sm: 28px;
  --text-title-lg: 22px;
  --text-title-md: 18px;
  --text-title-sm: 16px;
  --text-body-md: 16px;
  --text-body-sm: 14px;
  --text-caption: 13px;

  --leading-tight: 1.1;
  --leading-normal: 1.4;
  --leading-relaxed: 1.55;

  /* ---- Spacing ---- */
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  /* ---- Radius ---- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.10);

  /* ---- Layout ---- */
  --max-width: min(100%, 1200px);
  --sidebar-width: 300px;
  --header-height: 56px;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  font-weight: 400;
  line-height: var(--leading-relaxed);
  background: var(--canvas);
  color: var(--body);
  min-height: 100vh;
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); }
h1 { font-size: var(--text-display-md); line-height: var(--leading-tight); }
h2 { font-size: var(--text-title-lg); line-height: var(--leading-normal); }
h3 { font-size: var(--text-title-md); line-height: var(--leading-normal); }

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: 0.8; }

/* ============================================================
   4. HEADER
   ============================================================ */
.header {
  background: rgba(250,249,245,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; z-index: 20;
  padding: 0 var(--space-md);
}
.header-inner {
  max-width: var(--max-width); margin: 0 auto;
  height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between;
}

/* ---- Logo ---- */
.header-logo {
  font-family: var(--font-display);
  font-size: var(--text-title-sm);
  font-weight: 600;
  color: var(--ink);
  display: flex; align-items: center; gap: var(--space-xxs);
}
.header-logo .mark { color: var(--primary); }

/* ---- Tab Navigation ---- */
.tab-nav {
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: var(--header-height);
  z-index: 10;
}
.tab-nav a, .tab-nav span {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-body-sm);
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  display: inline-block;
}
.tab-nav a:hover { color: var(--ink); }
.tab-nav a.active, .tab-nav span.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================================
   5. BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--on-primary);
  font-family: var(--font-body); font-size: var(--text-body-sm); font-weight: 500;
  padding: var(--space-xs) var(--space-lg); border-radius: var(--radius-md);
  border: none; cursor: pointer; transition: background 0.15s;
  text-decoration: none; height: 36px;
}
.btn-primary:hover { background: var(--primary-active); }
.btn-primary:disabled { background: var(--primary-disabled); color: var(--muted); cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--canvas); color: var(--ink);
  font-family: var(--font-body); font-size: var(--text-body-sm); font-weight: 500;
  padding: var(--space-xs) var(--space-lg); border-radius: var(--radius-md);
  border: 1px solid var(--hairline); cursor: pointer; transition: all 0.15s;
  text-decoration: none; height: 36px;
}
.btn-secondary:hover { background: var(--surface-soft); }

.btn-login {
  display: inline-flex; align-items: center;
  background: var(--hairline-soft); color: var(--ink);
  font-family: var(--font-body); font-size: var(--text-body-sm); font-weight: 500;
  padding: var(--space-xs) var(--space-lg); border-radius: var(--radius-md);
  border: none; cursor: pointer; height: 36px;
}
.btn-login:hover { background: var(--hairline); }

.btn-ghost {
  display: inline-flex; align-items: center;
  background: transparent; color: var(--muted);
  font-size: var(--text-caption); font-weight: 500;
  border: none; cursor: pointer; text-decoration: underline;
}
.btn-ghost:hover { color: var(--ink); }

.edit-btn { font-size: 12px; color: var(--primary); cursor: pointer; text-decoration: underline; }
.edit-btn:hover { opacity: 0.7; }

/* ============================================================
   6. CARDS
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}
@media (min-width: 1200px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .card-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--on-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  cursor: pointer;
  display: flex; flex-direction: column; overflow: hidden;
  text-decoration: none; color: inherit;
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-cover {
  width: 100%; height: 110px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-display-sm);
  font-weight: 600;
  color: var(--muted-soft);
  background: linear-gradient(135deg, var(--hairline-soft), var(--hairline));
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: var(--space-sm) var(--space-md) 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.card-title {
  font-size: var(--text-body-sm);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--space-xxs);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
}

.card-desc {
  font-size: var(--text-caption);
  color: var(--muted);
  line-height: var(--leading-normal);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-xxs);
}

.card-footer {
  padding: var(--space-xs) var(--space-md) var(--space-sm);
  margin-top: var(--space-xs);
  display: flex; justify-content: space-between; align-items: center;
}

/* ============================================================
   7. BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 500; line-height: 1.6;
}
.badge-open { background: var(--hairline-soft); color: var(--muted); }
.badge-working { background: #e8e0d2; color: var(--primary); }
.badge-completed { background: var(--hairline); color: var(--body-strong); }

/* ============================================================
   8. MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.30);
  z-index: 100;
  align-items: center; justify-content: center;
  padding: var(--space-lg);
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--on-primary);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  padding: var(--space-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

/* ============================================================
   9. FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: var(--space-sm); }
.form-group label {
  display: block;
  font-size: var(--text-caption);
  color: var(--muted);
  margin-bottom: var(--space-xxs);
  font-weight: 500;
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: var(--text-body-sm);
  font-family: var(--font-body);
  outline: none;
  background: var(--on-primary);
  color: var(--ink);
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
}
.form-group textarea { min-height: 80px; resize: vertical; }

/* ============================================================
   10. LAYOUT
   ============================================================ */
.container, .page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-xxl);
}

.dashboard-layout {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
}
.dashboard-main { flex: 1; min-width: 0; }
.dashboard-side {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
}
@media (max-width: 768px) {
  .dashboard-layout { flex-direction: column; }
  .dashboard-side { width: 100%; position: static; }
}

/* ============================================================
   11. SECTION TITLES
   ============================================================ */
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-title-sm);
  font-weight: 600;
  color: var(--ink);
  margin: var(--space-lg) 0 var(--space-sm);
  display: flex; align-items: center; gap: var(--space-xs);
}
.section-title:first-child { margin-top: 0; }

/* ============================================================
   12. USER DROPDOWN
   ============================================================ */
.user-dropdown { position: relative; display: inline-block; cursor: pointer; }
.user-dropdown .trigger {
  font-size: var(--text-caption);
  color: var(--primary);
  font-weight: 500;
  padding: var(--space-xxs) var(--space-xs);
  border-radius: var(--radius-md);
  user-select: none;
}
.user-dropdown .trigger:hover { background: var(--hairline-soft); }
.user-dropdown .menu {
  display: none;
  position: absolute; right: 0; top: 100%; margin-top: var(--space-xxs);
  background: var(--on-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  z-index: 30; overflow: hidden;
}
.user-dropdown .menu a {
  display: block;
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-caption); color: var(--ink); text-decoration: none;
}
.user-dropdown .menu a:hover { background: var(--hairline-soft); }
.user-dropdown .menu .divider { border-top: 1px solid var(--hairline); }
.user-dropdown.open .menu { display: block; }

/* ============================================================
   13. STATES
   ============================================================ */
.empty {
  text-align: center;
  padding: var(--space-xxl) var(--space-md);
  color: var(--muted-soft);
  font-size: var(--text-body-sm);
}
.loading { text-align: center; padding: 60px; color: var(--muted-soft); }

/* ============================================================
   14. NOTIFICATIONS
   ============================================================ */
.notif {
  background: var(--on-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s;
}
.notif:hover { background: var(--hairline-soft); }
.notif .icon { font-size: 18px; flex-shrink: 0; }
.notif .body { flex: 1; font-size: var(--text-caption); line-height: 1.4; }
.notif .body .title { font-weight: 500; color: var(--ink); }
.notif .body .time { font-size: 11px; color: var(--muted-soft); margin-top: 2px; }
.notif-empty { text-align: center; padding: var(--space-lg); color: var(--muted-soft); font-size: var(--text-caption); }

/* ============================================================
   15. PROFILE CARD
   ============================================================ */
.profile-card {
  background: var(--surface-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  text-align: center;
  border: 1px solid var(--hairline);
  margin-bottom: var(--space-md);
}
.profile-card .av {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5a3c);
  margin: 0 auto var(--space-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 26px; font-weight: 600;
  color: var(--on-primary);
  overflow: hidden;
}
.profile-card .av img { width: 100%; height: 100%; object-fit: cover; }
.profile-card .name { font-size: var(--text-title-sm); font-weight: 600; color: var(--ink); }
.profile-card .email { font-size: var(--text-caption); color: var(--muted); margin-top: 2px; }

/* ============================================================
   15. STATUS BAR
   ============================================================ */
.status-bar {
  text-align: center;
  padding: var(--space-xs);
  font-size: 11px;
  color: var(--muted-soft);
}
