/* =========================================================
   Gerador de Enquetes — Layout Minimalista Light
   Inspirado em Linear / Vercel / Stripe
   ========================================================= */

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

:root {
    --bg: #fafafa;
    --card: #ffffff;
    --text: #0a0a0a;
    --muted: #737373;
    --border: #e5e5e5;
    --border-hover: #d4d4d4;
    --primary: #171717;
    --primary-hover: #000000;
    --accent: #3b82f6;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --radius: 10px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --transition: 0.15s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

/* ---------- Layout ---------- */

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.container.narrow {
    max-width: 480px;
}

/* ---------- Typography ---------- */

.eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
}

h1 {
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 12px;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.lead {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 420px;
    margin: 0 auto 32px;
}

/* ---------- Cards ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    box-shadow: var(--shadow);
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.925rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: #f5f5f5;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #ebebeb;
    border-color: var(--border-hover);
}

.btn-large {
    padding: 13px 22px;
    font-size: 0.975rem;
    border-radius: var(--radius);
}

.btn-small {
    padding: 7px 12px;
    font-size: 0.85rem;
}

.full {
    width: 100%;
}

/* ---------- Forms ---------- */

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 550;
    margin-bottom: 6px;
    color: var(--text);
}

small {
    color: var(--muted);
    font-size: 0.8rem;
}

textarea,
input[type="text"] {
    width: 100%;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

textarea:focus,
input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.08);
}

textarea::placeholder,
input::placeholder {
    color: #a3a3a3;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin: 28px 0 12px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.option-row input {
    flex: 1;
}

.remove-option {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-option:hover:not(:disabled) {
    background: var(--danger-bg);
    border-color: #fecaca;
    color: var(--danger);
}

.remove-option:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.error {
    color: var(--danger);
    font-size: 0.875rem;
    margin: 12px 0 0;
    padding: 10px 12px;
    background: var(--danger-bg);
    border-radius: var(--radius-sm);
}

.hidden {
    display: none !important;
}

/* ---------- Topbar / Back ---------- */

.topbar {
    margin-bottom: 20px;
}

.back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition);
}

.back:hover {
    color: var(--text);
}

/* ---------- Hero (index) ---------- */

.hero {
    text-align: center;
    padding: 64px 32px;
}

.hero .lead {
    margin-left: auto;
    margin-right: auto;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.info-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 16px;
}

.info-card strong {
    font-size: 0.9rem;
    font-weight: 600;
}

.info-card span {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
}

/* ---------- Live panel (enquete.php) ---------- */

.live-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.live-id {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 6px;
}

.live-id strong {
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #eff6ff;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.live-badge i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

.live-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.qr-card {
    text-align: center;
}

.qr-card h2 {
    margin-bottom: 4px;
}

#qrcode {
    display: flex;
    justify-content: center;
    margin: 16px 0 14px;
}

#qrcode img,
#qrcode canvas {
    border-radius: 8px;
}

.qr-card p {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.45;
    margin-bottom: 12px;
}

.join-url {
    background: #f5f5f5;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.72rem;
    word-break: break-all;
    color: var(--muted);
    line-height: 1.4;
}

/* Results */

.results-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
}

.results-title h2 {
    margin-bottom: 2px;
}

.results-title span {
    color: var(--muted);
    font-size: 0.8rem;
}

.total-votes {
    text-align: right;
    flex-shrink: 0;
}

.total-votes strong {
    display: block;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.total-votes span {
    display: block;
    margin-top: 3px;
    font-size: 0.8rem;
    color: var(--muted);
}

.result {
    margin-bottom: 20px;
}

.result:last-child {
    margin-bottom: 0;
}

.result-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.925rem;
}

.result-meta span {
    font-weight: 500;
}

.result-meta strong {
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.result-meta small {
    font-weight: 500;
    color: var(--muted);
    margin-left: 4px;
}

.bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 999px;
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Actions */

.actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* ---------- Vote screen (votar.php) ---------- */

.vote-card h1 {
    font-size: clamp(1.5rem, 6vw, 2rem);
    margin-bottom: 28px;
}

.vote-options {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

.vote-option {
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
    user-select: none;
}

.vote-option:hover {
    border-color: #a3a3a3;
    background: #fafafa;
}

.vote-option:has(input:checked) {
    border-color: var(--primary);
    background: #fafafa;
    box-shadow: 0 0 0 1px var(--primary);
}

.vote-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
    cursor: pointer;
}

.vote-message {
    text-align: center;
    padding: 32px 24px;
    border-radius: 12px;
    background: var(--success-bg);
    color: var(--success);
    line-height: 1.6;
    font-size: 1.05rem;
}

.vote-message strong {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 4px;
}

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

@media (max-width: 760px) {
    .container {
        padding: 28px 16px 48px;
    }

    .hero {
        padding: 48px 20px;
    }

    .card {
        padding: 22px;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .live-header {
        flex-direction: column;
        gap: 12px;
    }

    .live-layout {
        grid-template-columns: 1fr;
    }

    .qr-card {
        order: 2;
    }

    .results-card {
        order: 1;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        width: 100%;
    }

    .section-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 400px) {
    h1 {
        font-size: 1.6rem;
    }

    .vote-option {
        padding: 14px 14px;
    }
}
