/* ===== Tema VS Code Dark + accent rosu ===== */
:root {
    --bg:        #1e1e1e;
    --bg-deep:   #181818;
    --panel:     #252526;
    --panel-2:   #2d2d2d;
    --input:     #3c3c3c;
    --input-bd:  #4b4b4b;
    --border:    #333333;
    --text:      #d4d4d4;
    --text-dim:  #9d9d9d;
    --muted:     #858585;
    --accent:    #f14c4c;   /* rosu VS Code */
    --accent-2:  #ff6a6a;
    --accent-dim:#5a1f1f;
    --ok:        #4ec98a;
    --mono: "Cascadia Code", Consolas, "SF Mono", monospace;
    --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.35),
              0 2px 8px rgba(241,76,76,.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(241,76,76,.10), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(241,76,76,.06), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--sans);
    line-height: 1.65;
    font-size: 15px;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 22px;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.topbar .dot {
    width: 11px; height: 11px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(241,76,76,.18);
}
.topbar .brand {
    font-family: var(--mono); font-size: 13px; letter-spacing: .02em;
    color: var(--text-dim);
}

.content {
    flex: 1; width: 100%; max-width: 820px;
    margin: 0 auto; padding: 34px 20px 60px;
}
.content.content-wide { max-width: 100%; padding-left: 22px; padding-right: 22px; }

.footer {
    text-align: center; color: var(--muted); font-size: 12.5px;
    padding: 18px; border-top: 1px solid var(--border);
}
.footer strong { color: var(--text-dim); }

/* ===== Comutator chestionare (sageti) ===== */
.form-switch {
    display: flex; align-items: center; justify-content: center; gap: 14px;
    margin-bottom: 16px; padding: 8px 14px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow);
}
.form-switch .switch-name {
    font-family: var(--mono); font-size: 14px; color: var(--accent-2);
    text-align: center; font-weight: 700; flex: 1; min-width: 0;
}
.switch-arrow {
    flex: none; width: 38px; height: 38px; border-radius: 9px;
    display: grid; place-items: center; text-decoration: none;
    font-size: 24px; line-height: 1; color: var(--text);
    background: var(--input); border: 1px solid var(--input-bd);
    transition: transform .12s ease;
}
.switch-arrow:hover { border-color: var(--accent); color: var(--accent-2); transform: translateY(-1px); }
.switch-arrow:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(241,76,76,.30); }
.admin-switch { max-width: 640px; margin-left: auto; margin-right: auto; }

/* ===== Card ===== */
.form-card {
    position: relative;
    background: linear-gradient(180deg, var(--panel), #232324);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 30px 30px 26px;
}

.btn-reset {
    position: absolute; top: 14px; right: 14px; z-index: 5;
    padding: 7px 13px; font-size: 13px;
}

.form-head { border-bottom: 1px solid var(--border); padding-bottom: 18px; margin-bottom: 8px; padding-right: 130px; }
@media (max-width: 560px) {
    .form-head { padding-right: 0; padding-top: 40px; }
    .btn-reset { top: 10px; right: 10px; }
}
.form-head h1 {
    font-family: var(--mono); font-weight: 700; letter-spacing: -.01em;
    font-size: 24px; line-height: 1.25; margin: 0 0 12px;
    color: #fff;
}
.form-head h1::before { content: "// "; color: var(--accent); }
.form-desc { white-space: pre-wrap; color: var(--text-dim); font-size: 13.5px; margin: 0; }

/* ===== Sectiuni / questions ===== */
.step { border: 0; padding: 0; margin: 0 0 8px; }
.step[hidden] { display: none; }
.step:first-of-type { margin-top: 22px; }
.step-title {
    font-family: var(--mono); font-size: 18px; color: var(--accent-2);
    padding: 14px 0 6px; margin: 8px 0 6px; font-weight: 700;
    border-top: 1px solid var(--border);
}
.step-desc { color: var(--text-dim); white-space: pre-wrap; margin: 0 0 18px; font-size: 13.5px; }

.question {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 14px;
    transition: transform .18s ease;
}
.question:focus-within { border-left-color: var(--accent); transform: translateX(1px); }
.question.invalid { border-left-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim) inset; }

.q-label { display: block; font-weight: 600; color: #e9e9e9; margin-bottom: 6px; }
.q-label .req { color: var(--accent); margin-left: 4px; }
.q-desc { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; white-space: pre-wrap; }

/* ===== Inputs ===== */
.ipt {
    width: 100%; background: var(--input); color: var(--text);
    border: 1px solid var(--input-bd); border-radius: 8px;
    padding: 10px 12px; font-family: var(--sans); font-size: 14.5px;
    transition: transform .12s ease;
}
.ipt::placeholder { color: var(--muted); }
.ipt:focus-visible, .ipt:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(241,76,76,.20);
}
textarea.ipt { resize: vertical; }

/* ===== Options (radio / checkbox) ===== */
.options { display: flex; flex-direction: column; gap: 8px; }
.opt {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--input); border: 1px solid var(--input-bd);
    border-radius: 8px; padding: 9px 12px; cursor: pointer;
    transition: transform .12s ease;
}
.opt:hover { border-color: var(--accent-2); background: #444; }
.opt input { accent-color: var(--accent); margin-top: 3px; flex: none; }
.opt span { font-size: 14px; }
.opt:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(241,76,76,.18); }

/* ===== Optiunea "Altele" (text liber) ===== */
.opt-other { align-items: center; flex-wrap: wrap; }
.opt-other > span { flex: none; }
.other-text {
    flex: 1 1 160px; min-width: 140px; padding: 6px 10px; font-size: 13.5px;
    background: var(--panel-2);
}
.other-text:disabled { opacity: .45; cursor: not-allowed; }

/* ===== Mesaj de eroare per intrebare ===== */
.question.invalid { border-left-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim) inset; }
.q-error {
    display: block; margin-top: 8px; color: var(--accent-2);
    font-size: 12.5px; font-weight: 600;
}

/* ===== Grid ===== */
.grid { display: flex; flex-direction: column; gap: 8px; }
.grid-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; background: var(--input); border: 1px solid var(--input-bd);
    border-radius: 8px; padding: 9px 12px; flex-wrap: wrap;
    transition: transform .12s ease;
}
.grid-row.row-missing {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-dim) inset, 0 0 0 2px rgba(241,76,76,.18);
}
.grid-rowlabel { font-size: 13.5px; flex: 1 1 220px; }
.grid-cells { display: flex; gap: 8px; flex: none; }
.opt-cell { padding: 6px 14px; background: var(--panel-2); }

/* ===== Nav ===== */
.nav { display: flex; gap: 12px; margin-top: 24px; }
.btn {
    font-family: var(--sans); font-size: 14.5px; font-weight: 600;
    border-radius: 8px; padding: 11px 22px; cursor: pointer;
    border: 1px solid transparent;
    transition: transform .12s ease, opacity .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(241,76,76,.35); }
.btn-primary {
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    color: #fff; box-shadow: 0 4px 14px rgba(241,76,76,.30);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(241,76,76,.45); }
.btn-ghost {
    background: var(--input); color: var(--text); border-color: var(--input-bd);
}
.btn-ghost:hover { border-color: var(--accent-2); }
.btn[hidden] { display: none; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Alert ===== */
.alert {
    background: rgba(241,76,76,.10); border: 1px solid var(--accent);
    border-radius: 8px; padding: 12px 16px; margin: 16px 0; font-size: 13.5px;
}
.alert ul { margin: 8px 0 0; padding-left: 18px; }

/* ===== Thanks ===== */
.thanks { text-align: center; }
.thanks .check {
    width: 64px; height: 64px; margin: 6px auto 14px; border-radius: 50%;
    display: grid; place-items: center; font-size: 32px; color: #fff;
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    box-shadow: 0 8px 26px rgba(241,76,76,.4);
}
.thanks h1 { font-family: var(--mono); }
.thanks .btn { display: inline-block; margin-top: 18px; text-decoration: none; }
.muted { color: var(--muted); }

/* ===== Admin ===== */
.admin-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.admin-head h1 { font-family: var(--mono); margin: 0; font-size: 20px; }
.badge {
    background: var(--accent); color: #fff; border-radius: 99px;
    padding: 1px 11px; font-size: 13px; margin-left: 6px; vertical-align: middle;
}
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-actions .btn { text-decoration: none; padding: 8px 14px; }
.table-wrap { overflow: auto; margin-top: 18px; border: 1px solid var(--border); border-radius: 8px; max-height: 70vh; }
table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 12.5px; }
th, td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left; white-space: nowrap; }
thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-deep); color: var(--accent-2); font-family: var(--mono); }
tbody tr:hover { background: rgba(241,76,76,.06); }
.login .nav { justify-content: flex-end; }

/* ===== Admin editabil (ca Excel) ===== */
.admin-hint { font-size: 12.5px; margin: 4px 0 0; }
.col-actions { position: sticky; left: 0; z-index: 1; background: var(--panel); white-space: nowrap; }
thead th.col-actions { z-index: 3; background: var(--bg-deep); }
td .cell {
    background: transparent; border: 1px solid transparent; color: var(--text);
    font: inherit; padding: 4px 6px; border-radius: 5px; min-width: 110px; width: 100%;
}
td .cell:hover { border-color: var(--border); }
td .cell:focus { outline: none; border-color: var(--accent); background: var(--input);
    box-shadow: 0 0 0 2px rgba(241,76,76,.18); }
.rbtn {
    background: var(--input); border: 1px solid var(--input-bd); border-radius: 6px;
    cursor: pointer; font-size: 14px; line-height: 1; padding: 4px 7px; margin: 0 1px;
}
.rbtn:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.rbtn.del:hover { border-color: var(--accent); }
tbody tr.dirty .col-actions { box-shadow: inset 3px 0 0 var(--accent); }
tbody tr.dirty .save { border-color: var(--accent); background: var(--accent-dim); }
tbody tr.saved { animation: flashok 1.2s ease; }
tbody tr.error { animation: flasherr 1.2s ease; }
@keyframes flashok { 0% { background: rgba(78,201,138,.25); } 100% { background: transparent; } }
@keyframes flasherr { 0% { background: rgba(241,76,76,.30); } 100% { background: transparent; } }

/* rand marcat (taiat) - doar vizual */
tbody tr.struck .cell { text-decoration: line-through; opacity: .5; }
tbody tr.struck .col-actions { opacity: .8; }
.rbtn.strike { color: var(--ok); }
tbody tr.struck .rbtn.strike { background: var(--ok); color: #08110b; border-color: var(--ok); }

/* bara de cautare + filtrare */
.search-bar { display: flex; gap: 8px; margin: 14px 0 4px; flex-wrap: wrap; }
.search-bar .ipt { width: auto; }
.search-bar input[name="q"] { flex: 1 1 240px; min-width: 180px; }
.search-bar select[name="col"] { flex: 0 1 220px; max-width: 240px; }
.search-bar .btn { padding: 9px 16px; text-decoration: none; }

.import-form { display: inline; }
.import-form .btn { cursor: pointer; }
.alert.info { background: rgba(78,201,138,.12); border-color: var(--ok); color: #cde7d8; }

/* paginare */
.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.pager .btn { padding: 7px 13px; text-decoration: none; min-width: 38px; text-align: center; }
.pg-current { pointer-events: none; }
.pg-dots { color: var(--muted); padding: 0 4px; }
.pager-info { margin: 8px 0 0; font-size: 12.5px; }

@media (max-width: 560px) {
    .form-card { padding: 22px 16px; }
    .grid-row { flex-direction: column; align-items: stretch; }
    .grid-cells { justify-content: flex-start; }
}
