/* ══ AURA v2 — app.css ══════════════════════════════════════ */

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

/* ── Variables ──────────────────────────────────────────── */
:root {
  --bg:      #0d0d0f;
  --surface: #141417;
  --card:    #1a1a1f;
  --border:  #2a2a32;
  --border2: #323240;
  --text:    #e8e8f0;
  --muted:   #6b6b7e;
  --purple:  #7c6af7;
  --purple2: #9d8fff;
  --green:   #22c55e;
  --red:     #f43f5e;
  --amber:   #f59e0b;
  --blue:    #3b82f6;

  --nav-w:   220px;
  --topbar-h: 52px;
  --radius:  10px;
  --radius-sm: 6px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
}

/* ── Layout ─────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────── */
.nav {
  width: var(--nav-w);
  min-width: var(--nav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform .25s ease;
}
.nav-logo {
  padding: 18px 16px 12px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.5px;
  color: var(--purple2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-logo span { font-size: 10px; color: var(--muted); font-weight: 400; }
.nav-section { padding: 10px 10px 4px; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  margin: 1px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
  user-select: none;
  white-space: nowrap;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.on { background: rgba(124,106,247,.15); color: var(--purple2); }
.nav-item .ni { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--muted);
}
.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 4px;
}
.status-dot.off { background: var(--muted); }
.status-dot.warn { background: var(--amber); }

/* ── Mobile nav overlay ─────────────────────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}

/* ── Main area ───────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  background: var(--surface);
  flex-shrink: 0;
}
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.page-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}
.topbar-r { display: flex; align-items: center; gap: 8px; }

/* ── Pages ───────────────────────────────────────────────── */
.pages { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page { display: none; padding: 20px; max-width: 1200px; }
.page.on { display: block; }

.pg-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.pg-t { font-size: 18px; font-weight: 600; }
.pg-s { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card-t {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
}

/* ── Grids ───────────────────────────────────────────────── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.g4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.g6 { gap: 6px; }
.g8 { gap: 8px; }
.g12 { gap: 12px; }
.ai-c { align-items: center; }

/* ── Form elements ───────────────────────────────────────── */
.fg { display: flex; flex-direction: column; margin-bottom: 12px; }
.fg:last-child { margin-bottom: 0; }
.lbl { font-size: 10px; color: var(--muted); margin-bottom: 5px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }

.inp, .sel, .ta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 8px 10px;
  width: 100%;
  transition: border-color .15s;
  outline: none;
}
.inp:focus, .sel:focus, .ta:focus { border-color: var(--purple); }
.ta { resize: vertical; min-height: 80px; line-height: 1.5; }
.sel { cursor: pointer; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn-full { width: 100%; justify-content: center; padding: 10px; font-size: 12px; }
.bp { background: var(--purple); color: #fff; }
.bp:hover { background: var(--purple2); }
.bs { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.bs:hover { border-color: var(--border2); }
.bg { background: rgba(34,197,94,.15); color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.bg:hover { background: rgba(34,197,94,.25); }
.br { background: rgba(244,63,94,.12); color: var(--red); border: 1px solid rgba(244,63,94,.25); }
.br:hover { background: rgba(244,63,94,.2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 600;
}
.bg_ { background: rgba(34,197,94,.12); color: var(--green); }
.br_ { background: rgba(244,63,94,.12); color: var(--red); }
.bp_ { background: rgba(124,106,247,.15); color: var(--purple2); }

/* ── Stat cards ──────────────────────────────────────────── */
.stat { text-align: center; }
.stat-v { font-size: 28px; font-weight: 700; color: var(--purple2); font-family: 'DM Mono', monospace; }
.stat-l { font-size: 10px; color: var(--muted); margin-top: 3px; }

/* ── Persona cards ───────────────────────────────────────── */
.pc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.pc:hover { border-color: var(--purple); }
.pc.sel  { border-color: var(--purple); background: rgba(124,106,247,.07); }

.pc-av {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.pc-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pc-name  { font-size: 12px; font-weight: 600; }
.pc-niche { font-size: 10px; color: var(--muted); margin-top: 1px; }
.pc-meta  { font-size: 10px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.pc-meta span { color: var(--text); font-weight: 500; }
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.persona-card:hover { border-color: var(--purple); }
.persona-card.active { border-color: var(--purple); background: rgba(124,106,247,.07); }
.persona-avatar-ring {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  overflow: hidden;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.persona-avatar-ring img { width: 100%; height: 100%; object-fit: cover; }

/* ── Modals ──────────────────────────────────────────────── */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}
.modal-t {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--surface); }

/* ── Notifications ───────────────────────────────────────── */
#notif {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.notif-item {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  max-width: 280px;
  animation: slideIn .2s ease;
  pointer-events: auto;
}
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Spinner & loading states ────────────────────────────── */
.spin {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.blink { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.empty { color: var(--muted); font-size: 11px; text-align: center; padding: 30px 0; }

/* ── Typography helpers ──────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-red   { color: var(--red); }
.text-green { color: var(--green); }
.text-mono  { font-family: 'DM Mono', monospace; }
.mb4  { margin-bottom: 4px; }
.mb8  { margin-bottom: 8px; }
.mb12 { margin-bottom: 12px; }
.mb16 { margin-bottom: 16px; }
.mb20 { margin-bottom: 20px; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── Post cards ──────────────────────────────────────────── */
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.post-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.post-caption {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Daily post grid ─────────────────────────────────────── */
.daily-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* ── Avatar studio ───────────────────────────────────────── */
.av-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 48px;
}
.av-preview img,
.av-preview video { width: 100%; height: 100%; object-fit: cover; }

/* ── Pill tabs ───────────────────────────────────────────── */
.pills {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
}
.pill {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  border: none;
  background: none;
  font-family: inherit;
  transition: all .15s;
}
.pill.on, .pill:hover { background: var(--card); color: var(--text); }
.pill.on { color: var(--purple2); }

/* ── Avatar ring ─────────────────────────────────────────── */
.av-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.av-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 2px;
  transition: width .3s ease;
}

/* ══════════════════════════════════════════════════════════
   MOBILE — breakpoints
══════════════════════════════════════════════════════════ */

/* Tablet: 768px */
@media (max-width: 768px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 14px; }

  .nav {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 300;
  }
  .nav.open { transform: translateX(0); }
  .nav-overlay.open { display: block; }

  .menu-btn { display: block; }

  .topbar { padding: 0 12px; }

  .stat-v { font-size: 22px; }
}

/* Mobile: 480px */
@media (max-width: 480px) {
  body { overflow: auto; font-size: 14px; }
  .app { flex-direction: column; height: auto; min-height: 100vh; overflow: auto; }
  .main { overflow: visible; }
  .pages { overflow: visible; }

  .g2 { grid-template-columns: 1fr; }
  .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .daily-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .page { padding: 12px; }
  .pg-hd { margin-bottom: 14px; }
  .pg-t { font-size: 16px; }
  .pg-s { font-size: 12px; }

  .lbl { font-size: 11px; }
  .inp, .sel, .ta { font-size: 13px; padding: 9px 11px; }
  .card-t { font-size: 12px; }

  .topbar { height: 48px; min-height: 48px; padding: 0 10px; gap: 8px; }
  .topbar-r { gap: 6px; }
  .topbar-r .sel { width: 120px; font-size: 11px; padding: 4px 6px; }

  .modal { padding: 16px; max-height: 95vh; }
  .modal-t { font-size: 14px; }

  .card { padding: 12px; }

  .btn { font-size: 11px; padding: 7px 11px; }
  .btn-full { padding: 10px; font-size: 12px; }

  .persona-card { padding: 10px; }
  .persona-avatar-ring { width: 36px; height: 36px; font-size: 16px; }

  .pills { gap: 3px; }
  .pill { padding: 6px 10px; font-size: 11px; }

  #notif { bottom: 12px; right: 10px; left: 10px; }
  .notif-item { max-width: 100%; font-size: 13px; }

  .av-preview { aspect-ratio: 4/3; }

  .nav-logo { font-size: 15px; padding: 14px 12px 10px; }
  .nav-item { font-size: 12px; padding: 9px 10px; }

  /* Quick post button — zkrátit text na mobilu */
  .quick-post-label { display: none; }

  /* Avatar výsledek — nesmí být fullscreen */
  .avatar-result-img { max-width: 100%; max-height: 60vh; object-fit: contain; }
}

/* Very small: 360px */
@media (max-width: 360px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .daily-grid { grid-template-columns: 1fr; }
  .topbar-r .sel { width: 100px; }
}

/* Status dots JS-controlled */
.status-dot.on  { background: var(--green); }
.status-dot.off { background: var(--muted); }
.status-dot.warn { background: var(--amber); }