/* style.css — TautaAI.lv kopīgie stili */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg:        #07111E;
  --bg-card:   #0D1B2E;
  --bg-surface:#122438;
  --sidebar:   #060F1A;
  --border:    #1B3350;
  --border-h:  #2A4F74;
  --red:       #9E1320;
  --red-b:     #C0392B;
  --gold:      #C9A227;
  --green:     #27AE60;
  --amber:     #E67E22;
  --blue:      #2980B9;
  --text:      #DDE8F4;
  --text-muted:#6B8CAD;
  --text-dim:  #304D68;
  --mono:      'JetBrains Mono', monospace;
  --radius:    12px;
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── TYPOGRAPHY ─────────────────────────────── */
h1, h2, h3 { font-family: 'Playfair Display', serif; font-weight: 700; }
a { color: var(--text); text-decoration: none; }

/* ── CABINET LAYOUT ─────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  grid-template-rows: 56px calc(100vh - 56px);
  height: 100vh;
  overflow: hidden;
}
.app-topbar {
  grid-column: 1 / -1;
  background: rgba(6,15,26,0.98);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: relative;
  z-index: 50;
}
.app-sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 10px;
}
.app-main {
  overflow-y: auto;
  padding: 28px;
  background: var(--bg);
}

/* ── TOPBAR ELEMENTS ────────────────────────── */
.tb-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.tb-diamond {
  width: 28px; height: 28px; background: var(--red);
  transform: rotate(45deg); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tb-diamond span { transform: rotate(-45deg); font-family: var(--mono); font-size: 8px; color: white; }
.tb-name { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; }
.tb-name em { font-style: normal; color: var(--red); }
.tb-sep { width: 1px; height: 28px; background: var(--border); margin: 0 6px; }
.tb-role-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
}
.role-citizen  { background: rgba(41,128,185,.15); color: var(--blue); border: 1px solid rgba(41,128,185,.25); }
.role-deputy   { background: rgba(201,162,39,.15); color: var(--gold); border: 1px solid rgba(201,162,39,.25); }
.role-admin    { background: rgba(158,19,32,.15); color: #E05566; border: 1px solid rgba(158,19,32,.25); }
.tb-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tb-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  flex-shrink: 0;
}
.tb-username { font-size: 13px; font-weight: 500; }
.tb-email { font-size: 11px; color: var(--text-muted); }
.btn-logout {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--text-muted); font-size: 12px;
  cursor: pointer; font-family: 'Inter', sans-serif; transition: all .2s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ── SIDEBAR NAV ────────────────────────────── */
.sidebar-label {
  font-size: 9px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-dim); padding: 12px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  transition: all .2s; position: relative; margin-bottom: 2px;
}
.nav-item:hover { color: var(--text); background: var(--bg-surface); }
.nav-item.active { color: var(--text); background: var(--bg-surface); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; background: var(--red); border-radius: 0 2px 2px 0;
}
.nav-ico { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--red); color: white; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ── SECTION CONTENT ────────────────────────── */
.section { display: none; }
.section.active { display: block; }
.sec-hd { margin-bottom: 22px; }
.sec-hd h2 { font-size: 24px; margin-bottom: 4px; }
.sec-hd p { font-size: 13px; color: var(--text-muted); }

/* ── CARDS ──────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card-sm { padding: 14px 16px; }
.card-hover { transition: border-color .2s, transform .2s; cursor: pointer; }
.card-hover:hover { border-color: var(--border-h); transform: translateY(-2px); }

/* ── BUTTONS ────────────────────────────────── */
.btn {
  padding: 9px 20px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .2s; font-family: 'Inter', sans-serif;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--red); border: none; color: white; }
.btn-primary:hover { background: var(--red-b); }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-secondary:hover { border-color: var(--border-h); color: var(--text); }
.btn-gold { background: var(--gold); border: none; color: #000; }
.btn-gold:hover { opacity: .9; }
.btn-green { background: var(--green); border: none; color: white; }
.btn-green:hover { background: #2ECC71; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── FORMS ──────────────────────────────────── */
.f-group { margin-bottom: 16px; }
.f-label {
  display: block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); margin-bottom: 7px;
}
.f-input {
  width: 100%; padding: 10px 13px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: 'Inter', sans-serif;
  font-size: 13px; outline: none; transition: border-color .2s;
}
.f-input:focus { border-color: var(--red); }
.f-input::placeholder { color: var(--text-dim); }
.f-input:disabled { opacity: .5; cursor: not-allowed; }
textarea.f-input { resize: vertical; min-height: 90px; line-height: 1.5; }
select.f-input option { background: var(--bg-card); }
.f-hint { font-size: 11px; color: var(--text-dim); margin-top: 5px; }
.f-error { font-size: 12px; color: var(--red-b); margin-top: 5px; }

/* ── TAGS / BADGES ──────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
  white-space: nowrap;
}
.tag-sub     { background: rgba(107,140,173,.1); color: var(--text-muted); }
.tag-analyze { background: rgba(230,126,34,.1);  color: var(--amber); }
.tag-vote    { background: rgba(39,174,96,.1);   color: var(--green); }
.tag-comm    { background: rgba(201,162,39,.12); color: var(--gold); }
.tag-parl    { background: rgba(158,19,32,.12);  color: #E05566; }
.tag-reject  { background: rgba(107,107,107,.12);color: var(--text-dim); }

/* ── SCORE CIRCLE ───────────────────────────── */
.score-ring {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 13px; font-weight: 500;
}
.score-hi { background: rgba(39,174,96,.12);  color: var(--green); border: 1px solid rgba(39,174,96,.3); }
.score-md { background: rgba(230,126,34,.12); color: var(--amber); border: 1px solid rgba(230,126,34,.3); }
.score-lo { background: rgba(192,57,43,.12);  color: var(--red-b); border: 1px solid rgba(192,57,43,.3); }
.score-na { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }

/* ── PROGRESS BAR ───────────────────────────── */
.prog-track { flex: 1; height: 6px; background: var(--bg-surface); border-radius: 3px; overflow: hidden; }
.prog-fill  { height: 100%; border-radius: 3px; transition: width .6s ease; }
.prog-red   { background: linear-gradient(90deg, var(--red), var(--red-b)); }
.prog-gold  { background: linear-gradient(90deg, var(--gold), #E8C547); }
.prog-green { background: linear-gradient(90deg, var(--green), #2ECC71); }
.prog-blue  { background: linear-gradient(90deg, var(--blue), #3498DB); }

/* ── MODAL ──────────────────────────────────── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.84); backdrop-filter: blur(6px);
  z-index: 500; align-items: center; justify-content: center; padding: 16px;
}
.overlay.open { display: flex; }
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px; width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
}
.modal-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-hd h3 { font-size: 20px; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; line-height: 1;
}

/* ── STAT BOXES ─────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.stat-num { font-family: var(--mono); font-size: 28px; font-weight: 500; display: block; }
.stat-lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

/* ── ALERT BOXES ────────────────────────────── */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-warn  { background: rgba(230,126,34,.08); border: 1px solid rgba(230,126,34,.2); color: var(--amber); }
.alert-err   { background: rgba(192,57,43,.08);  border: 1px solid rgba(192,57,43,.2);  color: var(--red-b); }
.alert-ok    { background: rgba(39,174,96,.08);  border: 1px solid rgba(39,174,96,.2);  color: var(--green); }
.alert-info  { background: rgba(41,128,185,.08); border: 1px solid rgba(41,128,185,.2); color: var(--blue); }

/* ── LOADING SPINNER ────────────────────────── */
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--red); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 0 auto;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── DIVIDER ────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── RESPONSIVE ─────────────────────────────── */
.sidebar-toggle{display:none;background:none;border:none;color:var(--text);font-size:22px;cursor:pointer;padding:4px 8px;margin-right:6px;line-height:1}
.sidebar-backdrop{display:none;position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:39}
.sidebar-backdrop.show{display:block}
@media (max-width: 768px) {
  .sidebar-toggle{display:inline-block}
  .app-layout { grid-template-columns: 1fr; grid-template-rows: 56px auto 1fr; }
  .app-sidebar { display: none; }
  .app-sidebar.open { display: block; position: fixed; top: 56px; left: 0; bottom: 0; width: 240px; z-index: 40; overflow-y:auto; box-shadow: 4px 0 24px rgba(0,0,0,.4); }
  .app-main { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .app-topbar{padding:0 10px;gap:8px}
  .tb-role-badge,.tb-viewswitch,.tb-email,.tb-sep{display:none}
  .tb-user{gap:6px}
  .tb-username{max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}

/* ── AUTH PAGES ─────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 30%, rgba(158,19,32,.1) 0%, transparent 60%);
}
.auth-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 36px; width: 100%; max-width: 420px;
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; justify-content: center; }
.auth-logo-diamond {
  width: 36px; height: 36px; background: var(--red); transform: rotate(45deg);
  display: flex; align-items: center; justify-content: center;
}
.auth-logo-diamond span { transform: rotate(-45deg); font-family: var(--mono); font-size: 10px; color: white; }
.auth-logo-text { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; }
.auth-logo-text em { font-style: normal; color: var(--red); }
.auth-title { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 26px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.auth-divider span { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.auth-footer a { color: var(--red); }
.auth-footer a:hover { text-decoration: underline; }
