@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:wght@400;500&display=swap');

:root {
    --bg:        #0f1117;
    --surface:   #1a1d27;
    --surface2:  #22263a;
    --border:    #2e3250;
    --text:      #e8eaf6;
    --muted:     #7b82a8;
    --primary:   #5c6fff;
    --primary-h: #7b89ff;
    --success:   #22c55e;
    --danger:    #ef4444;
    --radius:    12px;
    --radius-lg: 20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
h1, h2, h3 { font-family: 'Sora', sans-serif; }

/* =============================================
   ADMIN
   ============================================= */
.admin-body { background: var(--bg); }
.admin-login {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 2.5rem;
    width: 100%; max-width: 380px; margin: 4rem auto; text-align: center;
}
.admin-login h1 { font-size: 1.8rem; margin-bottom: 1.5rem; }
.admin-login input[type="password"] {
    width: 100%; padding: 0.8rem 1rem;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text); font-size: 1rem; margin-bottom: 1rem;
}

.admin-wrap { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.admin-wrap h1 { font-size: 2rem; margin-bottom: 2rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; margin-bottom: 2rem; }
.card h2 { font-size: 1.2rem; margin-bottom: 1.2rem; }

.form-row { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.form-row label { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.form-row input, .form-row textarea {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.7rem 1rem;
    color: var(--text); font-size: 0.95rem; font-family: 'DM Sans', sans-serif;
    width: 100%; resize: vertical;
}
.form-row input:focus, .form-row textarea:focus { outline: none; border-color: var(--primary); }

.hint { font-size: 0.85rem; color: var(--muted); line-height: 1.6; }
.hint-inline { font-size: 0.8rem; color: var(--muted); font-weight: 400; }

.sessions-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.sessions-table th { text-align: left; padding: 0.6rem 0.8rem; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 600; }
.sessions-table td { padding: 0.75rem 0.8rem; border-bottom: 1px solid var(--border); }
.sessions-table tr:last-child td { border-bottom: none; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-question { background: #1e3a2a; color: #4ade80; }
.badge-finished { background: #2a2a2a; color: #9ca3af; }

/* =============================================
   BUTTONS
   ============================================= */
button, .btn-primary, .btn-secondary, .btn-sm {
    cursor: pointer; font-family: 'Sora', sans-serif; font-weight: 600;
    border: none; border-radius: var(--radius); transition: background 0.15s, transform 0.1s;
}
.btn-primary {
    background: var(--primary); color: #fff; padding: 0.75rem 1.8rem;
    font-size: 1rem; display: inline-block; text-decoration: none; text-align: center;
}
.btn-primary:hover { background: var(--primary-h); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
    background: var(--surface2); color: var(--text); padding: 0.75rem 1.8rem;
    font-size: 1rem; display: inline-block; text-decoration: none; text-align: center;
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-full { width: 100%; }
.btn-sm {
    background: var(--surface2); color: var(--text); padding: 0.3rem 0.85rem;
    font-size: 0.8rem; text-decoration: none; border: 1px solid var(--border); border-radius: 8px;
}
.btn-sm:hover { background: var(--border); }
.btn-danger { color: var(--danger) !important; border-color: #7f1d1d !important; }

/* =============================================
   MESSAGES
   ============================================= */
.error-msg   { background: #3b1111; color: #fca5a5; padding: 0.7rem 1rem; border-radius: var(--radius); font-size: 0.9rem; }
.success-msg { background: #112a1c; color: #86efac; padding: 0.7rem 1rem; border-radius: var(--radius); font-size: 0.9rem; }
.msg { margin-bottom: 1.2rem; }

/* =============================================
   POLL PAGE
   ============================================= */
.poll-body { background: var(--bg); }
.poll-wrap { max-width: 900px; margin: 0 auto; padding: 2rem 1.2rem 4rem; }

.poll-header { margin-bottom: 2rem; }
.poll-header h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.poll-desc { color: var(--muted); line-height: 1.6; margin-bottom: 0.5rem; }
.poll-deadline { color: var(--muted); font-size: 0.9rem; }
.poll-closed-badge {
    display: inline-block; background: var(--surface2); border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 14px; font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem;
}

/* Results grid */
.results-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; }
.results-card h2 { font-size: 1.1rem; margin-bottom: 1rem; }

.answer-legend { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 1rem; font-size: 0.85rem; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

.grid-scroll { overflow-x: auto; }

.poll-grid { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 400px; }
.poll-grid th { padding: 0.6rem 0.8rem; text-align: center; font-size: 0.8rem; color: var(--muted); border-bottom: 1px solid var(--border); font-family: 'Sora', sans-serif; font-weight: 600; }
.col-name { text-align: left !important; min-width: 120px; }
.col-option { min-width: 100px; max-width: 180px; word-break: break-word; }
.poll-grid td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); }
.poll-grid tr:last-child td { border-bottom: none; }
.cell-name { font-weight: 600; }
.cell-vote { text-align: center; }
.vote-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.vote-label { font-size: 0.82rem; }
.vote-empty { color: var(--muted); }

/* Summary row */
.summary-row td { background: var(--surface2); font-size: 0.82rem; padding: 0.7rem 0.8rem; border-top: 2px solid var(--border); }
.cell-summary { text-align: center; }
.summary-chip { display: inline-block; padding: 2px 8px; border-radius: 20px; color: #fff; font-size: 0.75rem; font-weight: 600; margin: 1px; }

/* Join form */
.join-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.join-card h2 { font-size: 1.1rem; margin-bottom: 0.8rem; }

/* =============================================
   VOTE PAGE
   ============================================= */
.vote-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; }

.vote-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.vote-table th { padding: 0.7rem 0.8rem; font-size: 0.85rem; border-bottom: 2px solid var(--border); font-family: 'Sora', sans-serif; font-weight: 700; }
.col-option-wide { text-align: left; min-width: 160px; }
.col-answer { text-align: center; min-width: 80px; }
.vote-table td { padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--border); }
.vote-table tr:last-child td { border-bottom: none; }
.vote-table tr:hover td { background: var(--surface2); }
.cell-option-label { font-weight: 500; }
.cell-radio { text-align: center; }

/* Custom radio */
.radio-label { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.radio-label input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-custom {
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid var(--border); background: var(--surface2);
    display: inline-block; transition: all 0.15s; position: relative;
}
.radio-label input[type="radio"]:checked + .radio-custom {
    background: var(--rc, var(--primary));
    border-color: var(--rc, var(--primary));
}
.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '✓'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%); color: #fff; font-size: 13px; font-weight: 700;
}
.radio-label:hover .radio-custom { border-color: var(--rc, var(--primary)); }

.vote-actions { display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; align-items: center; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 600px) {
    .poll-header h1 { font-size: 1.5rem; }
    .vote-table th, .vote-table td { padding: 0.5rem 0.4rem; font-size: 0.85rem; }
    .col-option-wide { min-width: 120px; }
    .col-answer { min-width: 60px; }
    .radio-custom { width: 20px; height: 20px; }
}

/* Comments */
.comment-row { display: flex; gap: 0.8rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.comment-row:last-child { border-bottom: none; }
.comment-name { font-weight: 600; min-width: 120px; flex-shrink: 0; }
.comment-text { color: var(--muted); }
.comment-cell { font-size: 0.85rem; color: var(--muted); max-width: 200px; }

/* Admin extras */
.email-link { color: var(--primary); text-decoration: none; font-size: 0.88rem; }
.email-link:hover { text-decoration: underline; }
.badge-waiting { background: #3a2a1e; color: #fb923c; }
