/* GrowBoard.me — Design System */
/* Teal palette, light, human */

:root {
  --primary:       #0F6E56;
  --primary-hover: #1D9E75;
  --primary-light: #E1F5EE;
  --primary-mid:   #5DCAA5;

  --bg:        #F7F8F6;
  --bg-card:   #FFFFFF;
  --border:    rgba(0,0,0,0.08);
  --border-md: rgba(0,0,0,0.14);

  --text:       #1A1F1C;
  --text-mid:   #4B5563;
  --text-light: #9CA3AF;

  --sidebar-bg:    #0F6E56;
  --sidebar-text:  rgba(255,255,255,0.75);
  --sidebar-active:#FFFFFF;
  --sidebar-hover: rgba(255,255,255,0.12);

  --radius:    10px;
  --radius-lg: 14px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Company colors */
  --co-mercanto: #3b5763;
  --co-pixbo:    #099E9F;
  --co-worki:    #544de0;
  --co-reachio:  #e65c00;
  --co-neowara:  #8b5cf6;

  /* Tier colors */
  --tier-0: #94a3b8;
  --tier-1: #60a5fa;
  --tier-2: #34d399;
  --tier-3: #f59e0b;
  --tier-4: #f97316;
  --tier-5: #a855f7;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ── */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* Legacy .sidebar / .main-content layout removed — handled by
   @mercantoeurope/design-tokens/app-layout.css via new shell. */

.page-wrapper {
  padding: 32px 36px;
  max-width: 100%;
}

/* ── Sidebar ── */
.sidebar-logo {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 8px;
}

.sidebar-logo-mark {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.sidebar-logo-text { font-size: 14px; font-weight: 600; color: #fff; }
.sidebar-logo-sub  { font-size: 10px; color: rgba(255,255,255,0.5); }

.sidebar-section {
  padding: 14px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.4);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  margin: 1px 6px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background .15s, color .15s;
  cursor: pointer;
}

.sidebar-item:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-item.active { background: rgba(255,255,255,0.18); color: var(--sidebar-active); }

.sidebar-item-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item.active .sidebar-item-dot { opacity: 1; }

.sidebar-bottom {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ── Mobile header ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--sidebar-bg);
  z-index: 200;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.mobile-header-title { font-size: 14px; font-weight: 600; color: #fff; }

.hamburger {
  width: 36px; height: 36px;
  background: none; border: none;
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.hamburger:hover { background: rgba(255,255,255,0.1); }

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
}

/* ── Bottom nav (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--sidebar-bg);
  z-index: 200;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 12px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  border-radius: 8px;
  transition: color .15s;
  min-width: 44px;
}

.bottom-nav-item.active, .bottom-nav-item:hover { color: #fff; }

.bottom-nav-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Page header ── */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 22px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.page-header p  { font-size: 14px; color: var(--text-light); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

/* ── Module card ── */
.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}

.module-card:hover {
  border-color: var(--primary-mid);
  box-shadow: 0 2px 12px rgba(15,110,86,0.08);
}

.module-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.module-card.completed {
  border-color: var(--primary-mid);
  background: #F0FDF4;
}

.module-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--primary-light);
}

.module-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.module-desc  { font-size: 12px; color: var(--text-light); line-height: 1.5; }
.module-meta  { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* ── Grid layouts ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }

/* ── Progress bar ── */
.progress-wrap { margin: 6px 0 2px; }
.progress-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-light); margin-bottom: 5px; }
.progress-track { height: 5px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s ease; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}

.badge-tier {
  background: #F1F5F9;
  color: var(--text-mid);
}

.badge-done    { background: #DCFCE7; color: #166534; }
.badge-active  { background: #DBEAFE; color: #1D4ED8; }
.badge-locked  { background: #F1F5F9; color: #94A3B8; }
.badge-new     { background: #FEF9C3; color: #854D0E; }

/* ── Stats bar ── */
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 28px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-light); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-sub   { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .88; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px;
  background: #fff; color: var(--text-mid);
  border: 1px solid var(--border-md); border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: border-color .15s, color .15s;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* ── Section tabs ── */
.section-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.section-tab {
  padding: 10px 18px;
  border: none; background: none;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--text-light); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all .15s;
}
.section-tab:hover { color: var(--text); }
.section-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Company dot ── */
.co-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ── Lesson content ── */
.lesson-content { max-width: 680px; }
.lesson-content h2 { font-size: 20px; font-weight: 600; margin: 28px 0 12px; color: var(--text); }
.lesson-content h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; color: var(--text); }
.lesson-content p  { font-size: 15px; color: var(--text-mid); line-height: 1.75; margin-bottom: 14px; }
.lesson-content ul, .lesson-content ol { padding-left: 20px; margin-bottom: 14px; }
.lesson-content li { font-size: 15px; color: var(--text-mid); line-height: 1.75; margin-bottom: 6px; }
.lesson-content strong { color: var(--text); font-weight: 600; }

.lesson-callout {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 14px;
  color: var(--primary);
}

/* ── Quiz ── */
.quiz-question { margin-bottom: 28px; }
.quiz-q-text { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 14px; line-height: 1.5; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card); border: 1.5px solid var(--border-md);
  border-radius: var(--radius); cursor: pointer;
  font-size: 14px; color: var(--text-mid);
  transition: border-color .15s, background .15s;
}
.quiz-option:hover { border-color: var(--primary); color: var(--text); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-light); color: var(--text); }
.quiz-option.correct  { border-color: #10B981; background: #F0FDF4; color: #065F46; }
.quiz-option.wrong    { border-color: #EF4444; background: #FEF2F2; color: #991B1B; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  padding: 10px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  display: none; pointer-events: none;
}
#toast.ok  { background: #1a1c23; color: #fff; }
#toast.err { background: #FEF2F2; color: #991B1B; border: 1px solid #FCA5A5; }
@keyframes toastIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open { display: flex; }
  .mobile-header { display: flex; }
  .bottom-nav { display: block; }
  .main-content { margin-left: 0; padding-top: 52px; padding-bottom: 80px; }
  .page-wrapper { padding: 20px 16px; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .mobile-overlay.open { display: block; }
}

@media (max-width: 480px) {
  .grid-3 { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: 1fr 1fr; }
}

/* ── Dark mode: přepsat růstoboardové proměnné na theme tokens ────────
   Tohle zaroveň opraví všechny .stat-card, .link-card, .quick-btn, .card
   a další komponenty co pracují s var(--bg-card) / var(--bg) / var(--text)
   protože se auto-přepnou v dark módu. */

:root[data-theme="dark"],
:root[data-theme="dark"] body {
  --bg:         #0f172a;
  --bg-card:    #1e293b;
  --border:     #334155;
  --border-md:  #475569;
  --text:       #f1f5f9;
  --text-mid:   #cbd5e1;
  --text-light: #94a3b8;
  --primary-light: color-mix(in srgb, var(--sidebar-accent, #10b981) 18%, #1e293b);
  --primary-mid:   color-mix(in srgb, var(--sidebar-accent, #10b981) 42%, #334155);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"],
  :root[data-theme="system"] body {
    --bg:         #0f172a;
    --bg-card:    #1e293b;
    --border:     #334155;
    --border-md:  #475569;
    --text:       #f1f5f9;
    --text-mid:   #cbd5e1;
    --text-light: #94a3b8;
    --primary-light: color-mix(in srgb, var(--sidebar-accent, #10b981) 18%, #1e293b);
    --primary-mid:   color-mix(in srgb, var(--sidebar-accent, #10b981) 42%, #334155);
  }
}

/* ── Dark mode defensive sweep — cílené opravy, kde nejde čistě přes tokens
   (gradienty, explicit hex na bg, atd.) ───────────────────────────────── */

[data-theme="dark"] {
  /* Hero card měla hardcoded linear-gradient(... #fff 100%) — přepíšeme */
  .hero-card {
    background: linear-gradient(135deg,
      color-mix(in srgb, var(--sidebar-accent) 14%, var(--bg-card)) 0%,
      var(--bg-card) 100%) !important;
    border-color: color-mix(in srgb, var(--sidebar-accent) 30%, var(--border)) !important;
  }
  .hero-cta { background: var(--sidebar-accent); }

  /* Badge varianty — hardcoded světlé bg */
  .badge-locked { background: color-mix(in srgb, #94a3b8 14%, var(--bg-card)); color: #94a3b8; }
  .badge-new    { background: color-mix(in srgb, #fbbf24 18%, var(--bg-card)); color: #fcd34d; }

  /* Quiz / status surfaces */
  .quiz-option.correct { background: color-mix(in srgb, #10b981 14%, var(--bg-card)); color: #6ee7b7; }
  .quiz-option.wrong   { background: color-mix(in srgb, #ef4444 14%, var(--bg-card)); color: #fca5a5; }


  /* Inspirace banner (index, knihovna) */
  .insp-banner {
    background: linear-gradient(135deg,
      color-mix(in srgb, var(--sidebar-accent) 8%, var(--surface-bg)) 0%,
      var(--surface-bg) 100%) !important;
    border-color: var(--color-border) !important;
  }
  .insp-banner-item,
  .insp-banner-head,
  .insp-banner-head strong,
  .insp-banner-title { color: var(--color-text); }
  .insp-banner-item {
    background: var(--surface-bg) !important;
    border-color: var(--color-border) !important;
  }
  .insp-banner-source { color: var(--sidebar-accent); }
  .insp-banner-summary { color: var(--color-text-muted); }

  /* Chat / mentor form inputs on /moje, /inspirace */
  .chat-msg.assistant,
  .insp-msg.assistant,
  .chat-form,
  .insp-form,
  .tester-option,
  .tester-chip,
  .quiz-textarea,
  .lib-search,
  .lib-select,
  .chip,
  .insp-chip,
  .insp-btn,
  .insp-chat-clear,
  .btn-team-invite,
  .team-invite-row,
  .team-invite-row:hover {
    background: var(--surface-bg) !important;
    color: var(--color-text);
    border-color: var(--color-border) !important;
  }
  .chat-form textarea,
  .insp-form textarea,
  .tester-setup select,
  .tester-setup input[type="number"],
  .tester-setup input[type="text"] {
    background: var(--color-bg) !important;
    color: var(--color-text);
    border-color: var(--color-border) !important;
  }

  /* Test-CC page (worki) purple tint */
  [style*="background: #ede9fe"],
  [style*="background:#ede9fe"] {
    background: color-mix(in srgb, var(--sidebar-accent) 14%, var(--surface-bg)) !important;
    color: var(--color-text);
  }

  /* Quiz feedback (dark cream → muted warm) */
  .quiz-result.failed {
    background: color-mix(in srgb, #fcd34d 18%, var(--surface-bg)) !important;
    border-color: color-mix(in srgb, #fcd34d 30%, var(--color-border)) !important;
    color: var(--color-text);
  }
  .lesson-type-external {
    background: color-mix(in srgb, #fcd34d 16%, var(--surface-bg)) !important;
    color: var(--color-text);
  }

  /* Toast — was pure black, invert for contrast */
  #toast.err {
    background: color-mix(in srgb, #ef4444 22%, var(--surface-bg)) !important;
    color: #fca5a5;
    border-color: color-mix(in srgb, #ef4444 40%, var(--color-border)) !important;
  }
}

/* ── Stejný sweep pro data-theme="system" + OS dark (default volba) ───── */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    .hero-card {
      background: linear-gradient(135deg,
        color-mix(in srgb, var(--sidebar-accent) 14%, var(--bg-card)) 0%,
        var(--bg-card) 100%) !important;
      border-color: color-mix(in srgb, var(--sidebar-accent) 30%, var(--border)) !important;
    }
    .hero-cta { background: var(--sidebar-accent); }
    .badge-locked { background: color-mix(in srgb, #94a3b8 14%, var(--bg-card)); color: #94a3b8; }
    .badge-new    { background: color-mix(in srgb, #fbbf24 18%, var(--bg-card)); color: #fcd34d; }
    .quiz-option.correct { background: color-mix(in srgb, #10b981 14%, var(--bg-card)); color: #6ee7b7; }
    .quiz-option.wrong   { background: color-mix(in srgb, #ef4444 14%, var(--bg-card)); color: #fca5a5; }

    .insp-banner {
      background: linear-gradient(135deg,
        color-mix(in srgb, var(--sidebar-accent) 8%, var(--surface-bg)) 0%,
        var(--surface-bg) 100%) !important;
      border-color: var(--color-border) !important;
    }
    .insp-banner-item {
      background: var(--surface-bg) !important;
      border-color: var(--color-border) !important;
      color: var(--color-text);
    }
    .insp-banner-source { color: var(--sidebar-accent); }
    .insp-banner-summary { color: var(--color-text-muted); }
    .insp-banner-head strong,
    .insp-banner-title { color: var(--color-text); }

    .chat-msg.assistant,
    .insp-msg.assistant,
    .chat-form,
    .insp-form,
    .tester-option,
    .tester-chip,
    .quiz-textarea,
    .lib-search,
    .lib-select,
    .chip,
    .insp-chip,
    .insp-btn,
    .insp-chat-clear {
      background: var(--surface-bg) !important;
      color: var(--color-text);
      border-color: var(--color-border) !important;
    }
    .chat-form textarea,
    .insp-form textarea {
      background: var(--color-bg) !important;
      color: var(--color-text);
      border-color: var(--color-border) !important;
    }

    #toast.err {
      background: color-mix(in srgb, #ef4444 22%, var(--surface-bg)) !important;
      color: #fca5a5;
      border-color: color-mix(in srgb, #ef4444 40%, var(--color-border)) !important;
    }
  }
}
