/* ----------------------------------------------------------------
   Menti PHP App · modernes, minimalistisches helles Design
   ---------------------------------------------------------------- */

:root {
    --bg:        #f7f8fa;
    --surface:   #ffffff;
    --border:    #e5e7eb;
    --border-2:  #d1d5db;
    --text:      #111827;
    --text-dim:  #6b7280;
    --text-soft: #4b5563;
    --accent:    #4f46e5;      /* indigo */
    --accent-2:  #6366f1;
    --accent-soft:#eef2ff;
    --danger:    #dc2626;
    --danger-soft:#fef2f2;
    --ok:        #059669;
    --ok-soft:   #ecfdf5;
    --warn:      #d97706;
    --warn-soft: #fffbeb;
    --radius:    10px;
    --radius-sm: 6px;
    --shadow:    0 1px 2px rgba(17,24,39,.04), 0 4px 12px rgba(17,24,39,.04);
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .6em; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 .75em; }

/* --- Layout --- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.topbar .brand {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    font-size: 1.05rem;
    display: flex; align-items: center; gap: 10px;
}
.topbar .brand .logo {
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: white; border-radius: 7px;
    font-size: 14px;
}
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
    color: var(--text-soft);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
}
.topbar nav a:hover { background: var(--bg); text-decoration: none; }
.topbar nav a.active { color: var(--text); background: var(--bg); }

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 24px 80px;
}
.container.narrow { max-width: 720px; }
.container.wide { max-width: 1280px; }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--text-dim); font-size: 14px; }

/* --- Cards --- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-split {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 720px) { .card-split { grid-template-columns: 1fr; } }

/* --- Buttons --- */

.btn, button.btn, input[type=submit].btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 14px;
    font: inherit; font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-2);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary {
    background: var(--accent); color: white; border-color: var(--accent);
}
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger {
    background: var(--surface); color: var(--danger); border-color: #fecaca;
}
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn.ghost:hover { background: var(--bg); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Forms --- */

label { display: block; font-size: 13px; font-weight: 500; color: var(--text-soft); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=url],
textarea, select {
    width: 100%;
    padding: 9px 12px;
    font: inherit;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
textarea { min-height: 80px; resize: vertical; }
.form-row { margin-bottom: 14px; }
.form-row.inline { display: flex; gap: 10px; align-items: center; }
.help { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.input-xl {
    font-size: 2rem; padding: 16px 18px; font-weight: 500;
    letter-spacing: -0.02em;
}

/* --- Table --- */

table.simple {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
table.simple th, table.simple td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}
table.simple th {
    background: #fafbfc;
    color: var(--text-soft);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
table.simple tr:last-child td { border-bottom: none; }
table.simple td .row-actions {
    display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap;
}

/* --- Badges --- */

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-soft);
    border: 1px solid var(--border);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #a7f3d0; }
.badge.archived { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.badge.type {
    background: var(--accent-soft); color: var(--accent); border-color: #c7d2fe;
    font-family: var(--font-mono); font-size: 11px;
}

/* --- Flash messages --- */

.flash {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid;
}
.flash.ok  { background: var(--ok-soft); border-color: #a7f3d0; color: var(--ok); }
.flash.err { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }
.flash.info{ background: var(--accent-soft); border-color: #c7d2fe; color: var(--accent); }

/* --- Public join page --- */

.join-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 30px 18px;
}
.join-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 24px;
    max-width: 560px;
    width: 100%;
    box-shadow: var(--shadow);
}

/* --- Question card (public) --- */

.q-title { font-size: 1.3rem; font-weight: 600; margin: 0 0 18px; letter-spacing: -0.01em; }
.q-type  { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }

.choice-list { display: grid; gap: 8px; }
.choice-list label {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 15px;
    color: var(--text);
    font-weight: 400;
    margin: 0;
}
.choice-list label:hover { background: var(--bg); }
.choice-list input { accent-color: var(--accent); }

.scale-row { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-row label {
    flex: 1 1 50px; min-width: 46px;
    text-align: center; padding: 14px 0; cursor: pointer;
    border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    font-weight: 600; font-size: 1.1rem; margin: 0;
    color: var(--text);
}
.scale-row label:hover { background: var(--bg); }
.scale-row input { display: none; }
.scale-row input:checked + span,
.scale-row label.selected { /* fallback */ }
.scale-row label:has(input:checked) {
    background: var(--accent); color: white; border-color: var(--accent);
}

/* --- Pin on image --- */

.pin-stage {
    position: relative; display: block;
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    cursor: crosshair; user-select: none;
    max-width: 100%;
}
.pin-stage img { display: block; width: 100%; height: auto; }
.pin-dot {
    position: absolute; width: 18px; height: 18px; transform: translate(-50%, -50%);
    border-radius: 50%; background: var(--accent); border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    pointer-events: none;
}
.pin-dot.small { width: 10px; height: 10px; opacity: .85; }

/* --- Word cloud --- */

.wordcloud {
    display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline;
    padding: 22px 10px; justify-content: center;
    min-height: 120px;
}
.wordcloud span {
    line-height: 1.1; color: var(--text);
    font-weight: 600;
}

/* --- Bars --- */

.bar-row { margin-bottom: 10px; }
.bar-row .bar-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.bar-row .bar-top .lbl { color: var(--text); font-weight: 500; }
.bar-row .bar-top .meta { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.bar {
    background: var(--bg); border-radius: 6px; height: 14px; position: relative; overflow: hidden;
    border: 1px solid var(--border);
}
.bar .fill {
    height: 100%; background: var(--accent); border-radius: 6px 0 0 6px;
    transition: width .4s ease;
    min-width: 2px;
}

/* --- Stats summary --- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.stat .v { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.stat .k { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }

/* --- QR section --- */
.qr-box {
    text-align: center;
    padding: 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.qr-box svg { max-width: 100%; height: auto; }
.qr-box .code {
    font-family: var(--font-mono); font-size: 1.2rem; letter-spacing: .06em;
    margin-top: 6px; color: var(--text);
}
.qr-box .link { word-break: break-all; font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* --- Modal (delete confirm) --- */
dialog.modal {
    border: none; border-radius: var(--radius);
    padding: 0; max-width: 440px; width: calc(100% - 40px);
    box-shadow: 0 12px 40px rgba(17,24,39,.2);
    color: var(--text);
}
dialog.modal::backdrop { background: rgba(17,24,39,.45); }
.modal-body { padding: 22px 22px 14px; }
.modal-foot { padding: 12px 22px 20px; display: flex; gap: 8px; justify-content: flex-end; }
.modal-body h3 { margin-bottom: 8px; }
.modal-body p { color: var(--text-soft); font-size: 14px; }
.modal-body .danger-note { color: var(--danger); font-size: 13px; }

/* --- Utility --- */
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.small { font-size: 13px; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.thankyou {
    text-align: center; padding: 40px 10px;
}
.thankyou .big {
    font-size: 2rem; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.02em;
}

/* --- One-Screen Ergebnisansicht ------------------------------------------ */
.results-screen.compact {
    min-height: calc(100vh - 140px);
}
.results-header {
    margin-bottom: 16px;
}
.results-header h1 {
    margin-bottom: 4px;
}
.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.results-grid.compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    align-items: start;
}
.result-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.result-card h2 {
    margin: 4px 0 12px;
    font-size: 1.02rem;
    line-height: 1.28;
    letter-spacing: -0.01em;
}
.result-card-head {
    margin-bottom: 4px;
}
.result-body {
    min-height: 0;
}
.results-screen.compact .result-card {
    height: min(42vh, 360px);
    overflow: hidden;
}
.results-screen.compact .result-body {
    overflow: auto;
    padding-right: 4px;
}
.results-screen.compact .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.results-screen.compact .stat {
    padding: 9px 10px;
}
.results-screen.compact .stat .v {
    font-size: 1.2rem;
}
.results-screen.compact .stat .k {
    font-size: 11px;
}
.results-screen.compact .wordcloud {
    min-height: 0;
    max-height: 180px;
    padding: 12px 8px;
    gap: 6px 10px;
    overflow: auto;
    justify-content: flex-start;
    align-content: flex-start;
}
.results-screen.compact .bar-row {
    margin-bottom: 8px;
}
.results-screen.compact .bar {
    height: 12px;
}
.open-results-list {
    display: grid;
    gap: 8px;
}
.open-answer {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}
.open-answer-text {
    font-size: 14px;
    line-height: 1.45;
}
.open-answer-meta {
    margin-top: 6px;
}
.results-screen.compact .open-results-list {
    max-height: 220px;
    overflow: auto;
}
.pin-result-layout {
    display: grid;
    gap: 10px;
}
.pin-stat-grid {
    margin-bottom: 0;
}
.result-pin-stage {
    overflow: visible;
    max-height: none;
}
.results-screen.compact .type-pin .result-body {
    overflow: visible;
}
.results-screen.compact .type-pin {
    height: auto;
    min-height: 0;
}
.results-screen.compact .result-pin-stage {
    max-height: none;
}
.results-screen.compact details {
    margin-top: 6px;
}
.results-screen.compact table.simple th,
.results-screen.compact table.simple td {
    padding: 8px 10px;
    font-size: 12px;
}
@media (max-width: 900px) {
    .results-grid.compact-grid {
        grid-template-columns: 1fr;
    }
    .results-screen.compact .result-card {
        height: auto;
        max-height: none;
    }
    .results-screen.compact .result-body {
        overflow: visible;
    }
    .results-screen.compact .type-pin {
        height: auto;
    }
}

/* --- Host Europe Variant: Branding + Footer + Privacy hinweis ------------ */
.topbar .brand { flex-wrap: wrap; row-gap: 2px; }
.topbar .brand .brand-name { font-weight: 700; }
.topbar .brand .brand-org {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-dim);
    margin-left: 6px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
    line-height: 1.1;
}
@media (max-width: 640px) {
    .topbar .brand .brand-org { display: none; }
}

.sitefoot {
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    padding: 24px 16px 32px;
    border-top: 1px solid var(--border);
    margin-top: 48px;
}
.sitefoot .sep { margin: 0 8px; opacity: .6; }
.sitefoot a { color: var(--text-dim); }

.privacy-notice {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.45;
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}
.privacy-notice strong { color: var(--text); font-weight: 600; }

.join-card .org-header {
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
    letter-spacing: .02em;
}