/* styles.css (UI ONLY) */

/* ────────────────────────────────────────────── Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body{
  font-family: Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0b1020;
  color: #e9eefc;
  -webkit-font-smoothing: antialiased;
}

/* ────────────────────────────────────────────── Topbar ────────────────────────────────────────────── */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(10, 14, 28, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid rgba(255,255,255,0.08);
}
.brand{ font-weight: 700; letter-spacing: 0.02em; }
.actions{ display:flex; gap:10px; align-items:center; }
.lang-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  font-weight: 800;
  font-size: 12px;
}
.container{ max-width: 1500px; margin: 0 auto; padding: 18px 18px 30px; }

/* ────────────────────────────────────────────── Cards + common UI ────────────────────────────────────────────── */
.card{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  min-height: 200px;
}
.card h1, .card h2{ margin: 0; letter-spacing: 0.01em; }

.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 10px;
}
.panel-actions{ display:flex; gap:8px; align-items:center; }

.pbtn{
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(233,238,252,0.9);
  border-radius: 10px;
  padding: 7px 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.pbtn:hover{ background: rgba(255,255,255,0.10); }

.row{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap: wrap;
  margin-top: 10px;
}

hr{
  border: none;
  border-top: 1px solid rgba(255,255,255,0.10);
  margin: 14px 0;
}

.label{
  display:block;
  margin: 12px 0 6px;
  font-size: 12px;
  color: rgba(233,238,252,0.8);
}

.input, .textarea{
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 10px 12px;
  color: #e9eefc;
  outline: none;
  font-family: Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
}
.textarea{ resize: vertical; }
.input::placeholder, .textarea::placeholder{ color: rgba(233,238,252,0.45); }

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #2f6bff;
  color: white;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}
.btn:hover{ opacity: 0.95; }
.btn.ghost{ background: transparent; color: #e9eefc; }

.muted{ color: rgba(233,238,252,0.72); }
.small{ font-size: 12px; }

/* subcards for structured blocks */
.subcard{
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
}

/* Mini controls next to labels */
.field { margin-top: 14px; }
.field-head {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
}
.field-controls{ display:flex; align-items:center; gap:10px; }
.input.small{ max-width: 260px; padding: 8px 10px; }
.toggle{ display:inline-flex; align-items:center; gap:8px; font-size: 12px; color: rgba(255,255,255,0.75); }
.toggle input { transform: translateY(1px); }

/* Toolbar */
.toolbar{ display:flex; gap:8px; margin: 8px 0 8px; }
.tbtn{
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.tbtn:hover{ background: rgba(255,255,255,0.10); }
.tbtn.tdot{
  width: 34px;
  min-width: 34px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tbtn.active{ outline: 2px solid rgba(47,107,255,0.6); }

/* ────────────────────────────────────────────── Modal (language picker) ────────────────────────────────────────────── */
.modal{
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
}
.modal-card{
  width: min(520px, 100%);
  background: rgba(15, 20, 40, 0.98);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  box-shadow: 0 20px 70px rgba(0,0,0,0.55);
  padding: 14px;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 10px;
}
.modal-title{ font-weight: 900; letter-spacing: 0.01em; }
.lang-list-ui{
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  overflow: hidden;
  max-height: 340px;
  overflow-y: auto;
}
.lang-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 10px 12px;
  cursor:pointer;
  background: rgba(255,255,255,0.03);
  border-bottom: 1.5px solid rgba(255,255,255,0.06);
}
.lang-item:hover{ background: rgba(255,255,255,0.06); }
.lang-item .code{ opacity: 0.65; font-size: 12px; }
.lang-item.active{
  background: rgba(47,107,255,0.18);
  border-bottom-color: rgba(47,107,255,0.18);
}

/* ────────────────────────────────────────────── 3-panel grid + resizers ────────────────────────────────────────────── */
.grid3{
  display:grid;
  grid-template-columns: 1.25fr 10px 1fr 10px 0.85fr;
  gap: 14px;
  align-items: start;
}
.v-resizer{
  width: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  cursor: col-resize;
  height: calc(100vh - 140px);
  position: sticky;
  top: 88px;
}
@media (max-width: 1180px){
  .grid3{ grid-template-columns: 1fr; }
  .v-resizer{ display:none; }
}

/* Panel hide */
.panel.is-hidden{ display:none !important; }

/* Fullscreen panel */
.panel.is-fullscreen{
  position: fixed !important;
  inset: 74px 16px 16px 16px !important;
  z-index: 9999 !important;
  overflow: auto;
}

/* Backdrop behind fullscreen panel */
.fullscreen-backdrop{
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
}

/* ────────────────────────────────────────────── AI Coach UI ────────────────────────────────────────────── */
.ai-chat{
  display:flex;
  flex-direction:column-reverse;
  gap:10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 12px;
  height: 460px;
  overflow:auto;
}
.ai-compose{ display:flex; gap:10px; margin-top: 10px; align-items: flex-end; }
.ai-input{ flex: 1; min-height: 68px; }
.ai-send{ height: 42px; padding: 0 16px; }

.msg{
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 10px 12px;
}
.msg.user{ background: rgba(47,107,255,0.12); border-color: rgba(47,107,255,0.25); }
.msg-title{ font-weight: 800; font-size: 12px; margin-bottom: 6px; opacity: 0.9; }

.sugg{ margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.10); padding-top: 10px; }
.sugg-item{
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 10px;
  margin-top: 10px;
}
.sugg-item .topic{ font-weight: 900; font-size: 12px; margin-bottom: 6px; }
.sugg-buttons{ display:flex; gap:10px; margin-top: 10px; }

.thinking-row{ display:flex; gap:10px; align-items:center; font-size: 13px; color: rgba(233,238,252,0.85); }
.spinner{
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: rgba(255,255,255,0.90);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* UI bullet toggle (fallback dersom template-variabler ikke er lastet ennå) */
.tbtn.tdot::before{
  content:"";
  width: var(--cv-dot-size, 4px);
  height: var(--cv-dot-size, 4px);
  border-radius: 50%;
  background: var(--cv-accent, #2f6bff);
}
