/* ═══════════════════════════════════════════════════════
   Eesti Sõnad — styles.css
   Light theme by default; dark via [data-theme="dark"]
   ═══════════════════════════════════════════════════════ */

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

/* ── LIGHT THEME (default) ─────────────────────────────── */
:root {
  --blue:         #185FA5;
  --blue-l:       #1a72c9;
  --blue-xl:      #1558a0;
  --blue-dim:     rgba(24,95,165,.10);
  --blue-border:  rgba(24,95,165,.28);

  --bg:           #f4f7fb;
  --bg2:          #ffffff;
  --bg3:          #eef2f8;
  --surface:      #e6ecf5;
  --surface2:     #dce4f0;
  --border:       rgba(0,0,0,.08);
  --border2:      rgba(0,0,0,.13);

  --text:         #18253a;
  --text2:        #4d6680;
  --text3:        #8da4be;

  --green:        #16a34a;
  --green-dim:    rgba(22,163,74,.11);
  --amber:        #b45309;
  --amber-dim:    rgba(180,83,9,.10);
  --red:          #dc2626;
  --red-dim:      rgba(220,38,38,.08);

  --topbar-bg:    rgba(244,247,251,.90);
  --scrollbar:    rgba(24,95,165,.18);

  --r:            10px;
  --r-sm:         7px;
  --mono:         'JetBrains Mono', monospace;
  --sans:         'Sora', sans-serif;
}

/* ── DARK THEME ─────────────────────────────────────────── */
[data-theme="dark"] {
  --blue-xl:      #5ba3e8;
  --blue-dim:     rgba(24,95,165,.15);
  --blue-border:  rgba(24,95,165,.35);

  --bg:           #080d14;
  --bg2:          #0e1520;
  --bg3:          #131e2e;
  --surface:      #182435;
  --surface2:     #1f2f44;
  --border:       rgba(255,255,255,.07);
  --border2:      rgba(255,255,255,.12);

  --text:         #dde6f0;
  --text2:        #7d9ab8;
  --text3:        #4a6480;

  --green:        #34d399;
  --green-dim:    rgba(52,211,153,.12);
  --amber:        #fbbf24;
  --amber-dim:    rgba(251,191,36,.12);
  --red:          #f87171;
  --red-dim:      rgba(248,113,113,.10);

  --topbar-bg:    rgba(8,13,20,.88);
  --scrollbar:    rgba(24,95,165,.25);
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .25s, color .25s;
}

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 99px; }



/* ── FLASH MESSAGES ─────────────────────────────────────── */
.flash-wrap { padding: 10px 20px 0; }
.flash {
  background: var(--blue-dim); border: 1px solid var(--blue-border);
  border-radius: var(--r-sm); padding: 9px 14px;
  font-size: .8rem; color: var(--blue); margin-bottom: 6px;
}
[data-theme="dark"] .flash { color: var(--blue-xl); }
.flash.error {
  background: var(--red-dim); border-color: var(--red);
  color: var(--red);
}

/* ── INPUT PANEL ─────────────────────────────────────────── */
.input-panel {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 20px;
  transition: background .25s;
}
.input-inner { max-width: 1180px; margin: 0 auto; }
.input-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px; align-items: start;
}
.input-label {
  font-size: .72rem; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 6px;
}
textarea {
  width: 100%;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r-sm); color: var(--text);
  font-family: var(--mono); font-size: .8rem;
  padding: 9px 12px; resize: vertical; min-height: 60px;
  transition: border-color .18s, background .25s;
}
textarea:focus { outline: none; border-color: var(--blue); }
textarea::placeholder { color: var(--text3); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.input-actions { display: flex; flex-direction: column; gap: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 16px; border-radius: var(--r-sm); border: none;
  font-family: var(--sans); font-size: .78rem; font-weight: 600;
  cursor: pointer; transition: all .18s; text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-l); box-shadow: 0 4px 14px rgba(24,95,165,.35); }
.btn-ghost {
  background: var(--surface); color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-danger {
  background: transparent; color: var(--text3);
  border: 1px solid var(--border);
  font-size: .72rem; padding: 6px 12px;
}
.btn-danger:hover { color: var(--red); border-color: var(--red); }

.input-row2 {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; flex-wrap: wrap;
}
.file-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border2);
  font-size: .75rem; font-weight: 600; color: var(--text2);
  cursor: pointer; transition: all .18s;
}
.file-label:hover { color: var(--text); }
input[type="file"] { display: none; }
#file-name { font-size: .72rem; color: var(--text3); }


/* ── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 72px 20px; color: var(--text3);
}
.empty-icon { font-size: 2.8rem; margin-bottom: 14px; opacity: .35; }
.empty-title {
  font-size: .95rem; font-weight: 600; color: var(--text2); margin-bottom: 6px;
}
.empty-sub { font-size: .82rem; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 700px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .input-grid { grid-template-columns: 1fr; }
  .input-actions { flex-direction: row; flex-wrap: wrap; }
  .topbar-divider { display: none; }
  .topbar-right { gap: 8px; }
  .topbar-user-email { display: none; }
}

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r); width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: .9rem; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-size: .9rem; padding: 2px 6px;
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border);
}

/* Text input (modal) */
.text-input {
  width: 100%; padding: 9px 12px;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r-sm); color: var(--text);
  font-family: var(--sans); font-size: .85rem;
  transition: border-color .18s;
}
.text-input:focus { outline: none; border-color: var(--blue); }

/* ══════════════════════════════════════════════════════
   AUTH PAGES (login, signup)
   ══════════════════════════════════════════════════════ */
.auth-wrap {
  min-height: calc(100vh - 56px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
  background: var(--bg);
}

.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 4px 32px rgba(0,0,0,.06);
  display: flex; flex-direction: column; gap: 20px;
}
[data-theme="dark"] .auth-card {
  box-shadow: 0 4px 32px rgba(0,0,0,.3);
}

.auth-header { text-align: center; }
.auth-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.auth-logo-img {
  width: 56px;
  height: 56px;
  display: block;
}
.auth-logo--icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--blue-dim);
  color: var(--blue);
}

.auth-logo-symbol {
  font-size: 28px;
}

[data-theme="dark"] .auth-logo--icon {
  color: var(--blue-xl);
}
.auth-title {
  font-size: 1.3rem; font-weight: 800;
  color: var(--text); letter-spacing: -.03em;
  margin-bottom: 6px;
}
.auth-sub { font-size: .82rem; color: var(--text2); }

/* Google button */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px;
  background: var(--bg3); border: 1.5px solid var(--border2);
  border-radius: 10px;
  font-family: var(--sans); font-size: .85rem; font-weight: 600;
  color: var(--text); text-decoration: none;
  transition: all .18s; cursor: pointer;
}
.btn-google:hover {
  border-color: var(--blue-border);
  background: var(--blue-dim);
  color: var(--text);
}

/* Divider */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text3); font-size: .75rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border2);
}

/* Form */
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label {
  font-size: .73rem; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .06em;
}
.auth-input {
  width: 100%; padding: 11px 14px;
  background: var(--bg3); border: 1.5px solid var(--border2);
  border-radius: 9px; color: var(--text);
  font-family: var(--sans); font-size: .88rem;
  transition: border-color .18s, box-shadow .18s;
}
.auth-input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
}
.auth-input::placeholder { color: var(--text3); }

.auth-forgot {
  font-size: .75rem; color: var(--text3);
  text-decoration: none; transition: color .15s;
}
.auth-forgot:hover { color: var(--blue); }

.auth-remember { margin-top: -4px; }

.auth-submit {
  width: 100%; justify-content: center;
  padding: 12px; font-size: .88rem;
  border-radius: 10px; margin-top: 4px;
}

.auth-error {
  background: var(--red-dim); border: 1px solid var(--red);
  border-radius: 8px; padding: 10px 14px;
  font-size: .8rem; color: var(--red);
}
.auth-field-error {
  font-size: .75rem; color: var(--red); margin-top: 2px;
}

.auth-footer {
  text-align: center; font-size: .8rem; color: var(--text2);
}
.auth-footer a {
  color: var(--blue); font-weight: 600; text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .auth-card { padding: 28px 20px; }
}

/* ══════════════════════════════════════════════════════
   APP LAYOUT — Sidebar + Main
   ══════════════════════════════════════════════════════ */
.app-topbar { border-bottom: 1px solid var(--border); }

.app-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ── SIDEBAR ───────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  transition: background .25s;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text2);
  transition: all .15s;
  position: relative;
}
.sidebar-item:hover { background: var(--blue-dim); color: var(--text); }
.sidebar-item.active { background: var(--blue-dim); color: var(--blue); }
[data-theme="dark"] .sidebar-item.active { color: var(--blue-xl); }

.sidebar-icon { font-size: 1rem; flex-shrink: 0; }
.sidebar-label { flex: 1; }
.sidebar-badge {
  background: var(--blue); color: #fff;
  font-size: .62rem; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 16px 12px 0;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-tier { display: flex; flex-direction: column; gap: 3px; }
.sidebar-tier-name { font-size: .78rem; font-weight: 700; color: var(--text); }
.sidebar-tier-sub  { font-size: .7rem; color: var(--text3); }
.sidebar-upgrade {
  font-size: .72rem; font-weight: 700;
  color: var(--blue); text-decoration: none;
  transition: opacity .15s;
}
.sidebar-upgrade:hover { opacity: .75; }
.sidebar-logout {
  font-size: .75rem; color: var(--text3);
  text-decoration: none; transition: color .15s;
  padding: 4px 0;
}
.sidebar-logout:hover { color: var(--red); }

/* ── MAIN AREA ──────────────────────────────────────────── */
.app-main {
  flex: 1;
  padding: 28px 32px 60px;
  min-width: 0;
  max-width: 960px;
}


@media (max-width: 900px) {
  .sidebar { display: none; }
  .app-main { padding: 16px; max-width: 100%; }
}


/* ── CATALOG ────────────────────────────────────────────── */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.catalog-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .18s, box-shadow .18s;
}
.catalog-card:hover {
  border-color: var(--blue-border);
  box-shadow: 0 4px 16px var(--blue-dim);
}
.catalog-card--copied {
  opacity: .7;
}
.catalog-card-header {
  display: flex; align-items: center; gap: 8px;
}
.catalog-level-badge {
  font-size: .62rem; font-weight: 800; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 4px;
}
.catalog-level-A1 { background: rgba(34,197,94,.15); color: #16a34a; }
.catalog-level-A2 { background: var(--blue-dim); color: var(--blue); }
[data-theme="dark"] .catalog-level-A2 { color: var(--blue-xl); }
.catalog-level-B1 { background: var(--amber-dim); color: var(--amber); }
.catalog-level-B2 { background: var(--red-dim); color: var(--red); }

.catalog-copied-badge {
  font-size: .65rem; font-weight: 700; color: var(--green);
  margin-left: auto;
}
.catalog-card-title {
  font-size: .9rem; font-weight: 700; color: var(--text);
  letter-spacing: -.01em;
}
.catalog-card-meta {
  font-size: .72rem; color: var(--text3);
}
.catalog-card-desc {
  font-size: .75rem; color: var(--text2); line-height: 1.5;
}
.catalog-btn {
  width: 100%; justify-content: center; margin-top: auto;
}
