/* ──────────────────────────────────────────────────────────────────
   Mötesprotokoll – Frontend Styles
   Aesthetic: Refined Scandinavian institutional — clean, trustworthy,
   typographically driven. Dark navy + warm white + amber accent.
   Font: DM Serif Display (headings) + Source Sans 3 (body)
──────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Source+Sans+3:wght@300;400;600;700&display=swap');

:root {
  --navy:      #1a2744;
  --navy-mid:  #243259;
  --navy-soft: #3a4f7a;
  --amber:     #e8a020;
  --amber-lt:  #fdf3de;
  --bg:        #f8f7f5;
  --white:     #ffffff;
  --text:      #1c1c1e;
  --text-muted:#6b7280;
  --border:    #ddd9d3;
  --border-dk: #c5c0b8;
  --success:   #2d7a4a;
  --danger:    #c0392b;
  --radius:    6px;
  --shadow:    0 2px 12px rgba(26,39,68,.08);
  --shadow-lg: 0 8px 32px rgba(26,39,68,.14);
  --font-head: 'DM Serif Display', Georgia, serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
  --trans:     .18s ease;
}

/* ── Base ────────────────────────────────────────────────────────── */
.protokoll-wrap {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1rem;
}

.prot-page-title,
.prot-title {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 400;
  color: var(--navy);
  margin-bottom: 1.5rem;
}

.prot-hidden { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.prot-btn {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .55em 1.3em;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--trans), color var(--trans), border-color var(--trans), transform var(--trans);
}
.prot-btn:active { transform: translateY(1px); }

.prot-btn-primary {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.prot-btn-primary:hover {
  background: var(--navy-mid);
  border-color: var(--navy-mid);
}

.prot-btn-secondary {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}
.prot-btn-secondary:hover {
  background: var(--navy);
  color: var(--white);
}

.prot-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-dk);
}
.prot-btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── Error / Empty ───────────────────────────────────────────────── */
.protokoll-error {
  background: #fef2f2;
  border-left: 4px solid var(--danger);
  padding: .8em 1em;
  border-radius: var(--radius);
  color: var(--danger);
}
.prot-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem 0;
}

/* ══════════════════════════════════════════════════════════════════
   EDITOR
══════════════════════════════════════════════════════════════════ */
#protokoll-editor {
  position: relative;
  min-height: 200px;
}

/* Screen transitions */
.prot-screen {
  animation: prot-fadein .25s ease;
}
@keyframes prot-fadein {
  from { opacity:0; transform: translateY(8px); }
  to   { opacity:1; transform: translateY(0); }
}

/* ── Form groups ─────────────────────────────────────────────────── */
.prot-form-group {
  margin-bottom: 1.2rem;
}
.prot-form-group label {
  display: block;
  font-weight: 600;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: .4rem;
}
.prot-form-group input,
.prot-form-group select,
.prot-form-group textarea {
  width: 100%;
  padding: .65em .9em;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--white);
  color: var(--text);
  transition: border-color var(--trans), box-shadow var(--trans);
  box-sizing: border-box;
}
.prot-form-group input:focus,
.prot-form-group select:focus,
.prot-form-group textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,39,68,.12);
}

.prot-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .prot-form-row { grid-template-columns: 1fr; }
}

/* ── Actions bar ─────────────────────────────────────────────────── */
.prot-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.5rem;
}
.prot-actions-spread {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Progress ────────────────────────────────────────────────────── */
.prot-progress-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.prot-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.prot-progress-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 3px;
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
.prot-progress-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Wizard grid ─────────────────────────────────────────────────── */
.prot-wizard-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 800px) {
  .prot-wizard-grid { grid-template-columns: 1fr; }
}

/* ── Punkt header ─────────────────────────────────────────────────── */
.prot-punkt-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--navy);
}
.prot-punkt-num {
  font-family: var(--font-head);
  font-size: 2rem;
  color: var(--amber);
  line-height: 1;
  min-width: 2rem;
}
.prot-punkt-rubrik {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--navy);
  margin: 0;
}

/* ── Rich editor toolbar ─────────────────────────────────────────── */
.prot-editor-toolbar {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .4rem .6rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.prot-tool {
  padding: .3em .6em;
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 700;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
  transition: background var(--trans), border-color var(--trans);
}
.prot-tool:hover {
  background: var(--white);
  border-color: var(--border-dk);
}
.prot-tool-sep {
  width: 1px;
  height: 1.2em;
  background: var(--border-dk);
  margin: 0 .2rem;
}
.prot-tool-beslut {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}
.prot-tool-beslut input[type=checkbox] {
  accent-color: var(--amber);
  cursor: pointer;
}

/* ── ContentEditable editor ──────────────────────────────────────── */
.prot-rich-editor {
  min-height: 220px;
  padding: 1rem;
  border: 1.5px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--white);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.prot-rich-editor:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,39,68,.1);
}
.prot-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Autosave status ─────────────────────────────────────────────── */
.prot-autosave-status {
  height: 1.4rem;
  font-size: .8rem;
  color: var(--text-muted);
  margin: .4rem 0;
  transition: opacity .3s;
}

/* ── Wizard navigation ───────────────────────────────────────────── */
.prot-nav-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  gap: .5rem;
}

/* ── Punkt nav dots ──────────────────────────────────────────────── */
.prot-punkt-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.prot-nav-dot {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 2px solid var(--border-dk);
  background: var(--white);
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all var(--trans);
}
.prot-nav-dot:hover {
  border-color: var(--navy);
  color: var(--navy);
}
.prot-nav-dot.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.prot-nav-dot.is-saved {
  border-color: var(--success);
  color: var(--success);
}
.prot-nav-dot.is-saved.is-active {
  background: var(--success);
  border-color: var(--success);
  color: var(--white);
}
.prot-nav-dot.is-beslut::after {
  content: '★';
  position: absolute;
  font-size: .5rem;
  top: 0; right: 0;
  color: var(--amber);
}
.prot-nav-dot { position: relative; }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.prot-wizard-sidebar {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: .875rem;
}
.prot-sidebar-header {
  background: var(--navy);
  color: var(--white);
  padding: .75rem 1rem;
  font-weight: 600;
  font-size: .85rem;
  display: flex;
  gap: .5rem;
  align-items: center;
}
.prot-sidebar-content {
  padding: 1rem;
  max-height: 320px;
  overflow-y: auto;
  line-height: 1.6;
  color: var(--text);
}
.prot-sidebar-empty {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 1rem 0;
}

/* ── Summary screen ──────────────────────────────────────────────── */
.prot-summary-list {
  margin: 1.5rem 0;
}
.prot-summary-item {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: .75rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.prot-summary-num {
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--amber);
  line-height: 1;
  text-align: center;
}
.prot-summary-rubrik {
  font-weight: 700;
  margin-bottom: .25rem;
}
.prot-summary-text {
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.5;
}
.prot-summary-beslut {
  display: inline-block;
  background: var(--amber);
  color: var(--navy);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: .5em;
}

/* ── Loading overlay ─────────────────────────────────────────────── */
.prot-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.8);
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  z-index: 10;
}
.prot-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: prot-spin .7s linear infinite;
}
@keyframes prot-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════
   LIST VIEW
══════════════════════════════════════════════════════════════════ */
.prot-new-btn { margin-bottom: 1.5rem; }

.prot-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prot-list-item {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow);
  transition: box-shadow var(--trans), border-color var(--trans);
}
.prot-list-item:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--navy-soft);
}
.prot-list-meta {
  display: flex;
  gap: 1rem;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .4rem;
}
.prot-list-title {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 400;
  margin: 0 0 .8rem;
}
.prot-list-title a {
  color: var(--navy);
  text-decoration: none;
  transition: color var(--trans);
}
.prot-list-title a:hover { color: var(--amber); }
.prot-list-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
}
.prot-punkt-count { color: var(--text-muted); }
.prot-list-actions { display: flex; gap: 1rem; }
.prot-link {
  color: var(--navy-soft);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--trans);
}
.prot-link:hover { color: var(--amber); }

/* ══════════════════════════════════════════════════════════════════
   PROTOCOL VIEW
══════════════════════════════════════════════════════════════════ */
.protokoll-view {}

.prot-view-header {
  border-bottom: 2px solid var(--navy);
  padding-bottom: 1.2rem;
  margin-bottom: 2rem;
}
.prot-view-header h2 {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 400;
  color: var(--navy);
  margin-bottom: .6rem;
}
.prot-view-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: .8rem;
}
.prot-view-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.prot-view-punkter { display: flex; flex-direction: column; gap: 1.5rem; }

.prot-view-punkt {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.prot-view-punkt.is-beslut {
  border-left: 4px solid var(--amber);
  background: var(--amber-lt);
}
.prot-view-punkt-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .8rem;
}
.prot-view-punkt-num {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  background: var(--navy);
  color: var(--white);
  border-radius: 50%;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.prot-view-punkt-rubrik {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--navy);
  margin: 0;
  flex: 1;
}
.prot-beslut-badge {
  background: var(--amber);
  color: var(--navy);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: 3px;
}
.prot-view-punkt-innehall {
  line-height: 1.7;
  color: var(--text);
  padding-left: 3rem;
}
.prot-view-punkt-innehall p { margin-bottom: .7em; }
.prot-view-punkt-innehall ul,
.prot-view-punkt-innehall ol { padding-left: 1.5em; margin-bottom: .7em; }
