/* static/style.css */

/* ----- Theme tokens ----- */
:root{
  --bg: #0b0f19;
  --panel: #121a2b;
  --panel-2: #0f1626;
  --text: #e7ecff;
  --muted: rgba(231,236,255,.72);
  --border: rgba(231,236,255,.12);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --focus: rgba(231,236,255,.25);

  --btn: rgba(231,236,255,.08);
  --btn-hover: rgba(231,236,255,.12);
  --primary: #4f7cff;
  --primary-hover: #3f6df4;
  --danger: #ff5a6b;

  --radius: 16px;
  --radius-sm: 12px;
}

html[data-theme="light"]{
  --bg: #f6f8ff;
  --panel: #ffffff;
  --panel-2: #f3f5ff;
  --text: #121833;
  --muted: rgba(18,24,51,.72);
  --border: rgba(18,24,51,.14);
  --shadow: 0 10px 28px rgba(18,24,51,.12);
  --focus: rgba(18,24,51,.18);

  --btn: rgba(18,24,51,.06);
  --btn-hover: rgba(18,24,51,.10);
  --primary: #295dff;
  --primary-hover: #1f51f3;
}

/* ----- Base ----- */
*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: radial-gradient(1200px 800px at 20% 0%, rgba(79,124,255,.16), transparent 60%),
              radial-gradient(1000px 600px at 80% 10%, rgba(255,90,107,.10), transparent 60%),
              var(--bg);
  color: var(--text);
}

a{ color: inherit; text-decoration: none; }
a:hover{ text-decoration: underline; }

.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ----- Topbar ----- */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(0,0,0,.35), rgba(0,0,0,0));
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

html[data-theme="light"] .topbar{
  background: linear-gradient(to bottom, rgba(246,248,255,.85), rgba(246,248,255,0));
}

.brand{ display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.brand-title{ font-weight: 800; letter-spacing: .2px; font-size: 18px; }
.brand-sub{ font-size: 12px; color: var(--muted); }

.topbar-actions{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ----- Controls ----- */
select, input, textarea{
  width: 100%;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
}

select{
  width: auto;
  min-width: 150px;
}

input:focus, textarea:focus, select:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(79,124,255,.5);
}

textarea{ resize: vertical; }

/* ----- Buttons ----- */
.btn{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--btn);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:hover{ background: var(--btn-hover); text-decoration: none; }

.btn.primary{
  background: var(--primary);
  border-color: rgba(255,255,255,.0);
  color: #fff;
}
.btn.primary:hover{ background: var(--primary-hover); }

.btn:disabled{ opacity: .6; cursor: not-allowed; }

/* ----- Card ----- */
.card{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0)),
              var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

h1{
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: .2px;
}

.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* ----- Form layout ----- */
.form{ margin-top: 18px; }
.row{ margin: 14px 0; }
.row > label{
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--muted);
}

.hint{
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.row.checkbox label{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  user-select: none;
}
.row.checkbox input[type="checkbox"]{
  width: 18px; height: 18px;
  margin-top: 2px;
}

.row.actions{
  display: flex;
  align-items: center;
  gap: 12px;
}

.msg{
  font-size: 13px;
  color: var(--muted);
}
.msg.ok{ color: rgba(120,255,180,.95); }
.msg.err{ color: rgba(255,120,140,.95); }

.sep{
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* ----- RTL support ----- */
html[dir="rtl"] body{ direction: rtl; }
html[dir="rtl"] .topbar{ flex-direction: row-reverse; }
html[dir="rtl"] .topbar-actions{ flex-direction: row-reverse; }
html[dir="rtl"] .row.actions{ flex-direction: row-reverse; }
html[dir="rtl"] .row.checkbox label{ flex-direction: row-reverse; }

/* ----- Responsive ----- */
@media (max-width: 720px){
  .topbar{
    flex-direction: column;
    align-items: stretch;
  }
  .topbar-actions{
    justify-content: space-between;
    flex-wrap: wrap;
  }
  select{ width: 100%; }
  .row.actions{ flex-direction: column; align-items: stretch; }
}
