/* =======================================================
   Survey popup + admin — JO:TAC
   Orbitron for display titles only; Inter for body/UI text.
   ======================================================= */

:root {
    --bg-dark:        #111;
    --bg-darker:      #0a0a0a;
    --bg-card:        #151515;
    --bg-input:       #0c0c0c;

    --text-light:     #f0f0f0;
    --text-body:      #d6d6d6;
    --text-muted:     #8a8a8a;
    --text-faint:     #5a5a5a;

    --accent:         #1aff6a;
    --accent-soft:    rgba(26, 255, 106, 0.08);
    --accent-border:  rgba(26, 255, 106, 0.35);
    --accent-glow:    rgba(26, 255, 106, 0.35);

    --border:         #262626;
    --border-strong:  #3a3a3a;

    --danger:         #ff5e5e;

    --font-display:   'Orbitron', 'Segoe UI', sans-serif;
    --font-body:      'Inter', -apple-system, 'Segoe UI', Roboto, system-ui, Arial, sans-serif;

    --radius-card:    14px;
    --radius-block:   10px;
    --radius-control: 8px;
}

/* Set a sane base font everywhere — individual pages override as needed */
.survey-overlay,
.demo-body,
.admin-body,
.login-body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Popup overlay ---------- */

.survey-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 40px 16px;
}

.survey-overlay.is-open { display: block; }

.survey-card {
    position: relative;
    max-width: 560px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-card);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(26, 255, 106, 0.10);
    padding: 34px 32px 26px;
    color: var(--text-body);
}

.survey-card h2 {
    font-family: var(--font-display);
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.survey-card .survey-sub {
    margin: 0 0 26px;
    color: var(--text-muted);
    font-size: 13px;
}

.survey-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.survey-close:hover { color: var(--accent); background: rgba(255, 255, 255, 0.04); }

/* ---------- Questions ---------- */

.survey-question {
    margin: 18px 0;
    padding: 18px 18px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-block);
    background: var(--bg-darker);
}

.survey-question legend,
.survey-question .q-label {
    display: block;
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.1px;
    margin-bottom: 2px;
    padding: 0;
}

.survey-question .q-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 14px;
    font-weight: 400;
}

/* Conditional section (shown/hidden via JS) */
.survey-question.is-conditional         { display: none; }
.survey-question.is-conditional.is-visible {
    display: block;
    animation: surveyFadeIn 0.25s ease;
}
@keyframes surveyFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Sub-blocks inside a compound question (e.g. Q6) */
.q-sub { margin-top: 14px; }
.q-sub:first-of-type { margin-top: 6px; }

.q-sublabel {
    display: block;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 10px;
    padding: 0;
}

/* Per-section free-text field (smaller than main Q5 textarea) */
.q-detail {
    width: 100%;
    box-sizing: border-box;
    margin-top: 12px;
    background: var(--bg-input);
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 11px;
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.5;
    min-height: 46px;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.q-detail::placeholder {
    color: var(--text-faint);
    font-style: italic;
}
.q-detail:focus {
    outline: none;
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px rgba(26, 255, 106, 0.12);
}

/* Pill-style options */
.survey-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.survey-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    background: var(--bg-input);
    color: var(--text-body);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    user-select: none;
}

.survey-options label:hover {
    border-color: var(--accent-border);
    color: var(--text-light);
}

.survey-options input[type="radio"],
.survey-options input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--border-strong);
    background: transparent;
    margin: 0;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.survey-options input[type="radio"]    { border-radius: 50%; }
.survey-options input[type="checkbox"] { border-radius: 3px; }

.survey-options input:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.survey-options input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #000;
}

.survey-options input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 4px;
    height: 8px;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    transform: rotate(45deg);
}

.survey-options label:has(input:checked) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.survey-options label:has(input:disabled) {
    opacity: 0.3;
    cursor: not-allowed;
}
.survey-options label:has(input:disabled):hover {
    border-color: var(--border-strong);
    color: var(--text-body);
}

/* ---------- Text inputs ---------- */

.survey-card textarea,
.survey-card input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-input);
    color: var(--text-light);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    padding: 11px 13px;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.survey-card textarea { min-height: 90px; }

.survey-card textarea::placeholder,
.survey-card input::placeholder {
    color: var(--text-faint);
}

.survey-card textarea:focus,
.survey-card input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 255, 106, 0.15);
}

.survey-name-row { margin-top: 14px; }
.survey-name-row label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

/* ---------- Footer ---------- */

.survey-footer {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.survey-submit {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-control);
    padding: 12px 22px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26, 255, 106, 0.25);
    transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}

.survey-submit:hover    { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(26, 255, 106, 0.45); }
.survey-submit:active   { transform: translateY(0); }
.survey-submit:disabled { opacity: 0.5; cursor: wait; transform: none; }

.survey-status {
    font-size: 13px;
    color: var(--text-muted);
}
.survey-status.is-error   { color: var(--danger); }
.survey-status.is-success { color: var(--accent); }

/* Post-submit thank-you */
.survey-thanks {
    text-align: center;
    padding: 48px 20px;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 22px;
}
.survey-thanks small {
    display: block;
    margin-top: 12px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 13px;
}

/* ---------- Dedicated /survey/ landing page ---------- */

.survey-page {
    background: radial-gradient(ellipse at top, #0f2e0f 0%, var(--bg-darker) 55%);
    color: var(--text-body);
    font-family: var(--font-body);
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    box-sizing: border-box;
}

.survey-backdrop {
    max-width: 560px;
    text-align: center;
}
.survey-backdrop h1 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 44px;
    margin: 0 0 14px;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(26, 255, 106, 0.4);
}
.survey-backdrop p {
    color: var(--text-body);
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 10px;
}
.survey-backdrop p.muted {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 22px;
}

/* ---------- Demo page scaffolding ---------- */

.demo-body {
    background: var(--bg-darker);
    color: var(--text-body);
    margin: 0;
    padding: 60px 24px;
    min-height: 100vh;
}

.demo-wrap {
    max-width: 820px;
    margin: 0 auto;
}

.demo-wrap h1 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 26px;
    margin: 0 0 12px;
    letter-spacing: 0.5px;
}

.demo-wrap p {
    color: var(--text-body);
    line-height: 1.65;
    margin: 0 0 12px;
}

.demo-wrap code {
    background: var(--bg-input);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.demo-controls {
    margin-top: 26px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.demo-btn {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-control);
    padding: 9px 18px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.demo-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }

/* ---------- Admin dashboard ---------- */

.admin-body {
    background: var(--bg-darker);
    color: var(--text-body);
    margin: 0;
    padding: 30px 24px 80px;
    min-height: 100vh;
}

.admin-wrap { max-width: 1200px; margin: 0 auto; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
    margin-bottom: 22px;
}

.admin-header h1 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 22px;
    margin: 0;
    letter-spacing: 0.4px;
}

.admin-header a {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    border: 1px solid var(--border-strong);
    padding: 6px 14px;
    border-radius: var(--radius-control);
    transition: color 0.15s, border-color 0.15s;
}
.admin-header a:hover { color: var(--accent); border-color: var(--accent); }

.admin-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.admin-stat {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-block);
    padding: 14px 20px;
    min-width: 150px;
}
.admin-stat .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}
.admin-stat .value {
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--accent);
    margin-top: 4px;
    font-weight: 600;
}

.admin-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 54px;
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 4px;
    margin-bottom: 22px;
    background: var(--bg-dark);
    border-radius: 4px;
}
.admin-sparkline .bar {
    flex: 1;
    background: var(--accent);
    min-width: 4px;
    min-height: 2px;
    opacity: 0.7;
    border-radius: 2px 2px 0 0;
    transition: opacity 0.15s;
}
.admin-sparkline .bar:hover { opacity: 1; box-shadow: 0 0 8px var(--accent-glow); }

.admin-filters {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-block);
    padding: 16px 18px;
    margin-bottom: 18px;
    display: flex;
    gap: 14px;
    align-items: end;
    flex-wrap: wrap;
}
.admin-filters label {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}
.admin-filters input,
.admin-filters select {
    margin-top: 5px;
    background: var(--bg-input);
    color: var(--text-light);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 7px 10px;
    font-family: var(--font-body);
    font-size: 13px;
}
.admin-filters input:focus,
.admin-filters select:focus {
    outline: none;
    border-color: var(--accent);
}
.admin-filters button,
.admin-filters a.btn {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 600;
    font-family: var(--font-body);
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.2px;
    transition: transform 0.1s, box-shadow 0.15s;
}
.admin-filters button:hover,
.admin-filters a.btn:hover { box-shadow: 0 4px 14px rgba(26, 255, 106, 0.3); }
.admin-filters a.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent-border);
}
.admin-filters a.btn-secondary:hover { background: var(--accent-soft); }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-block);
    overflow: hidden;
    font-size: 13px;
}
.admin-table th,
.admin-table td {
    text-align: left;
    padding: 11px 14px;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    background: #0a0a0a;
    color: var(--accent);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(26, 255, 106, 0.03); }

.chip {
    display: inline-block;
    padding: 3px 10px;
    margin: 2px 3px 2px 0;
    border: 1px solid var(--accent-border);
    background: var(--accent-soft);
    border-radius: 999px;
    font-size: 11.5px;
    color: var(--accent);
    font-weight: 500;
}

.detail-text {
    margin-top: 6px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid var(--border-strong);
    color: var(--text-body);
    font-size: 12px;
    font-style: italic;
    line-height: 1.45;
    white-space: normal;
    max-width: 260px;
}

.q6-affected {
    display: inline-block;
    padding: 3px 10px;
    margin-bottom: 4px;
    background: rgba(26, 255, 106, 0.14);
    border: 1px solid var(--accent);
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
}

.admin-pager {
    margin-top: 20px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.admin-pager a,
.admin-pager span {
    padding: 7px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--text-body);
    font-size: 12px;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.admin-pager a:hover { border-color: var(--accent); color: var(--accent); }
.admin-pager .current { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* ---------- Login ---------- */

.login-body {
    background: var(--bg-darker);
    color: var(--text-body);
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-card);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(26, 255, 106, 0.15);
    padding: 32px;
    width: 100%;
    max-width: 380px;
}
.login-card h1 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 18px;
    margin: 0 0 18px;
    letter-spacing: 0.5px;
}
.login-card input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-input);
    color: var(--text-light);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    padding: 11px 13px;
    font-family: var(--font-body);
    font-size: 14px;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}
.login-card input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 255, 106, 0.15);
}
.login-card button {
    width: 100%;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-control);
    padding: 11px;
    font-weight: 700;
    font-family: var(--font-body);
    font-size: 14px;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.login-card button:hover { box-shadow: 0 4px 16px rgba(26, 255, 106, 0.4); }
.login-card .error {
    color: var(--danger);
    font-size: 12.5px;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: rgba(255, 94, 94, 0.08);
    border: 1px solid rgba(255, 94, 94, 0.25);
    border-radius: 6px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .survey-card { padding: 24px 20px 20px; }
    .survey-card h2 { font-size: 18px; }
    .survey-question { padding: 14px 14px 12px; }
    .survey-footer { flex-direction: column; align-items: stretch; }
    .survey-submit { width: 100%; }
    .admin-table { font-size: 11.5px; }
    .admin-table th, .admin-table td { padding: 8px 10px; }
    .admin-stats { flex-direction: column; }
    .admin-stat { min-width: 0; }
}
