/* TruePolls Petitions — Public Styles */
:root {
    --tp-purple: #6b3fa0;
    --tp-purple-dark: #4e2d78;
    --tp-gold: #c9a227;
    --tp-red: #b22234;
    --tp-navy: #3c3b6e;
}
.tppet-page { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #111; }

/* ── Layout: sidebar + main ── */
.tppet-layout { display: flex; gap: 28px; align-items: flex-start; max-width: 1200px; margin: 0 auto; padding: 20px; }
.tppet-main { flex: 1; min-width: 0; }

/* ── Sidebar container ── */
.tppet-sidebar {
    flex: 0 0 260px; position: relative; z-index: 3;
    background: rgba(255,255,255,0.95); border: 1px solid rgba(107,63,160,0.18);
    border-radius: 16px; padding: 20px 18px;
    box-shadow: 0 6px 24px rgba(60,59,110,0.14);
}
.tppet-sidebar-title {
    margin: 0 0 12px; font-size: 20px; font-weight: 800; color: var(--tp-purple);
    letter-spacing: -0.01em; border-bottom: 2px solid var(--tp-gold); padding-bottom: 8px;
}
.tppet-sidebar-list { list-style: none; margin: 0; padding: 0; }
.tppet-sidebar-list li { margin: 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
.tppet-sidebar-list li a {
    display: block; padding: 11px 8px; color: #333; text-decoration: none;
    font-size: 14px; font-weight: 600; border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.tppet-sidebar-list li a:hover { background: #f4f0fa; color: var(--tp-purple); }
.tppet-sidebar-list li.is-current a { background: var(--tp-purple); color: #fff; }
.tppet-star { color: var(--tp-gold); }
.tppet-sidebar-empty { font-size: 13px; color: #666; margin: 0; }
.tppet-archive-cta { margin-top: 16px; text-align: center; }

/* ── Buttons ── */
.tppet-btn {
    display: inline-block; border: none; border-radius: 999px;
    background: var(--tp-purple); color: #fff;
    font-size: 15px; font-weight: 700; padding: 12px 26px;
    cursor: pointer; text-decoration: none; text-align: center;
    transition: background 0.2s;
}
.tppet-btn:hover { background: var(--tp-purple-dark); color: #fff; }
.tppet-btn-outline {
    display: inline-block; background: transparent; color: var(--tp-purple);
    border: 2px solid var(--tp-purple); border-radius: 999px;
    font-size: 13px; font-weight: 700; padding: 9px 20px;
    cursor: pointer; text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.tppet-btn-outline:hover { background: var(--tp-purple); color: #fff; }

/* ── Petition view ── */
.tppet-petition {
    background: #fff; border-radius: 20px; padding: 30px 28px;
    box-shadow: 0 6px 24px rgba(60,59,110,0.12); border: 1px solid rgba(0,0,0,0.05);
}
.tppet-petition-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.tppet-petition-title { margin: 0; font-size: 30px; font-weight: 800; color: var(--tp-purple); letter-spacing: -0.02em; }
.tppet-badges { display: flex; gap: 8px; }
.tppet-badge {
    display: inline-block; border-radius: 999px; padding: 5px 14px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
}
.tppet-badge-active   { background: #e6f6ec; color: #1a7d43; border: 1px solid #b8e4c8; }
.tppet-badge-archived { background: #f2eefa; color: var(--tp-purple); border: 1px solid #ddd0f0; }

/* ── Counter + goal progress ── */
.tppet-counter {
    margin: 18px 0; padding: 16px 20px; border-radius: 14px;
    background: #f7f5fb; border: 1px solid rgba(107,63,160,0.14);
    display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.tppet-counter-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #666; }
.tppet-counter-value { font-size: 34px; font-weight: 900; color: var(--tp-purple); line-height: 1; }
.tppet-counter-goal  { font-size: 14px; color: #666; font-weight: 600; }
.tppet-progress {
    flex-basis: 100%; height: 10px; border-radius: 999px;
    background: #e8e2f3; overflow: hidden; margin-top: 8px;
}
.tppet-progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--tp-purple), var(--tp-gold)); }

.tppet-petition-body { font-size: 16px; line-height: 1.7; color: #222; }

.tppet-sign-cta { margin: 22px 0 8px; text-align: center; }
.tppet-privacy-note { font-size: 12.5px; color: #666; margin: 10px auto 0; max-width: 480px; }

.tppet-empty-box {
    background: #fff; border-radius: 20px; padding: 44px 28px; text-align: center;
    box-shadow: 0 6px 24px rgba(60,59,110,0.12);
}

/* ── Signature sheet ── */
.tppet-sheet-cta { margin-top: 22px; border-top: 1px solid rgba(0,0,0,0.08); padding-top: 18px; text-align: center; }
.tppet-sheet-note { font-size: 12.5px; color: #666; margin: 10px 0 0; }
.tppet-sheet-note a { color: var(--tp-purple); font-weight: 700; }
.tppet-sheet-scroll { max-height: 420px; overflow-y: auto; border: 1px solid rgba(0,0,0,0.08); border-radius: 10px; }

/* ── Full signature sheet page (/petition/sheet/{id}) ── */
.tppet-sheet-page { max-width: 900px; margin: 0 auto; padding: 20px; }
.tppet-sheet-nav {
    display: flex; flex-wrap: wrap; gap: 10px;
    align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.tppet-sheet-nav-right { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tppet-sheet-nav-bottom { margin: 22px 0 10px; }
.tppet-sheet-nav button.tppet-btn-outline { font-family: inherit; }
.tppet-sheet-doc {
    background: #fff; border-radius: 18px; padding: 32px 30px;
    box-shadow: 0 6px 24px rgba(60,59,110,0.12); border: 1px solid rgba(0,0,0,0.05);
}
.tppet-sheet-head { border-bottom: 3px solid var(--tp-purple); padding-bottom: 16px; margin-bottom: 18px; }
.tppet-sheet-title {
    margin: 0; font-size: 15px; font-weight: 800; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--tp-gold);
}
.tppet-sheet-petition { margin: 4px 0 10px; font-size: 28px; font-weight: 800; color: var(--tp-purple); letter-spacing: -0.02em; }
.tppet-sheet-meta { margin: 0 0 10px; font-size: 14px; color: #444; }
.tppet-sheet-privacy {
    margin: 0; font-size: 12.5px; color: #666; line-height: 1.5;
    background: #f7f5fb; border-left: 3px solid var(--tp-purple);
    padding: 10px 12px; border-radius: 0 8px 8px 0;
}
.tppet-sheet-table-full { width: 100%; }
.tppet-sheet-table-full th { position: static; }
.tppet-sheet-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tppet-sheet-table th {
    position: sticky; top: 0; background: var(--tp-purple); color: #fff;
    text-align: left; padding: 10px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
}
.tppet-sheet-table td { padding: 9px 14px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.tppet-sheet-table tr:nth-child(even) td { background: #faf8fd; }
.tppet-sheet-empty { font-size: 14px; color: #666; }

/* ── Modal ──
   Overlay is the single scroll container (align-items:flex-start +
   overflow-y:auto) — no nested scrolling, so dropdowns can't trap the
   scroll gesture. Divi column z-index neutralized below. */
.et_pb_column:has(.tppet-modal-overlay) { z-index: auto !important; }
.tppet-modal-overlay {
    position: fixed; inset: 0; z-index: 999995;
    background: rgba(20,10,40,0.55);
    display: none; align-items: flex-start; justify-content: center;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 20px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.tppet-modal-overlay.tppet-modal-open { display: flex; }
.tppet-modal-box {
    position: relative;
    background: #fff; border-radius: 20px;
    max-width: 640px; width: 100%;
    margin: 0 0 20px;
    padding: 32px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    animation: tppet-modal-in 0.25s cubic-bezier(0.34,1.4,0.64,1) both;
}
@keyframes tppet-modal-in { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tppet-modal-box { animation: none; } }
.tppet-modal-close {
    position: absolute; top: 14px; right: 16px;
    width: 32px; height: 32px; border-radius: 50%;
    border: none; background: #f2eefa; color: #666;
    font-size: 20px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.tppet-modal-close:hover { background: var(--tp-purple); color: #fff; }
.tppet-modal-title { margin: 0 0 14px; font-size: 24px; font-weight: 800; color: var(--tp-purple); }

.tppet-privacy-banner {
    background: #f6f2fb; border: 1px solid #ddd0f0; border-radius: 10px;
    padding: 12px 14px; font-size: 13px; color: #4e2d78; margin-bottom: 18px; line-height: 1.5;
}

/* ── Form ── */
.tppet-form-section {
    margin: 20px 0 10px; font-size: 13px; font-weight: 800; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--tp-purple);
    border-bottom: 1px solid rgba(107,63,160,0.15); padding-bottom: 6px;
}
.tppet-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.tppet-field label { display: block; font-size: 13px; font-weight: 600; color: #333; margin-bottom: 5px; }
.tppet-field input, .tppet-field select {
    width: 100%; padding: 11px 13px; border: 1.5px solid #ddd; border-radius: 10px;
    font-size: 15px; color: #111; background: #fafafa; box-sizing: border-box;
}
.tppet-field input:focus, .tppet-field select:focus { border-color: var(--tp-purple); outline: none; background: #fff; }
.tppet-field-full { grid-column: 1 / -1; }
.tppet-agree {
    margin-top: 16px; background: #f8f7fc; border: 1px solid #e2dcf0;
    border-radius: 10px; padding: 13px 15px;
}
.tppet-checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.55; color: #333; }
.tppet-checkbox input { margin-top: 3px; flex-shrink: 0; }

.tppet-field input.tppet-locked-field { background: #eeeef4; color: #555; cursor: not-allowed; }
.tppet-field-hint { display: block; margin-top: 4px; font-size: 11.5px; color: #6b6b7d; }

/* ── Electronic signature (E-SIGN / UETA) ── */
.tppet-esign-notice {
    background: #fffdf5; border: 1px solid #e8dcb4; border-left: 4px solid #c9a227;
    border-radius: 8px; padding: 11px 14px; margin: 0 0 14px;
    font-size: 12.5px; line-height: 1.55; color: #5b4a1c;
}
/* Specificity beats `.tppet-field input` without needing !important. */
.tppet-field input.tppet-signature-input {
    font-family: "Segoe Script", "Brush Script MT", "Snell Roundhand", cursive;
    font-size: 22px; letter-spacing: 0.5px; padding: 12px 14px;
    background: #fffef8; border-color: #c9bfa0; color: #1a1a3a;
}
.tppet-field input.tppet-signature-input:focus { background: #fff; border-color: var(--tp-purple); }
.tppet-field input.tppet-signature-input::placeholder { font-size: 19px; color: #c2b89c; }

.tppet-form-msg { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin: 14px 0; line-height: 1.5; }
.tppet-form-msg.is-error   { background: #fff0f0; border: 1px solid #fcc; color: #c0392b; }
.tppet-form-msg.is-success { background: #e6f6ec; border: 1px solid #b8e4c8; color: #1a7d43; }
.tppet-submit-btn { width: 100%; margin-top: 12px; }

/* ── Archive list (mirrors the Archive Polls table conventions) ── */
.tppet-archive-container { max-width: 1100px; margin: 0 auto; padding: 20px; }
.tppet-archive-heading { text-align: center; font-size: 28px; font-weight: 800; color: var(--tp-purple); margin: 0 0 20px; }
.tppet-grid-wrapper { overflow-x: auto; }
.tppet-grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 24px rgba(60,59,110,0.10); }
.tppet-grid thead th {
    background: var(--tp-purple); color: #fff; text-align: left;
    padding: 13px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
}
.tppet-grid tbody td { padding: 14px 16px; border-bottom: 1px solid rgba(0,0,0,0.05); font-size: 14px; vertical-align: middle; }
.tppet-grid tbody tr:hover td { background: #faf8fd; }
.tppet-row-title { margin: 0; font-size: 16px; font-weight: 700; }
.tppet-row-title a { color: var(--tp-navy); text-decoration: none; }
.tppet-row-title a:hover { color: var(--tp-purple); }
.tppet-goal-met { color: #1a7d43; font-weight: 700; }

.tppet-pagination { text-align: center; margin: 22px 0; }
.tppet-pagination .page-numbers {
    display: inline-block; padding: 8px 14px; margin: 0 3px; border-radius: 8px;
    background: #fff; color: var(--tp-purple); text-decoration: none; font-weight: 700;
    border: 1px solid rgba(107,63,160,0.25);
}
.tppet-pagination .page-numbers.current { background: var(--tp-purple); color: #fff; }

.tppet-login-required {
    max-width: 640px; margin: 30px auto; background: #fff; border-radius: 16px;
    padding: 34px 28px; text-align: center; font-size: 16px; color: #333;
    box-shadow: 0 6px 24px rgba(60,59,110,0.12); border: 1px solid rgba(0,0,0,0.05);
}
.tppet-login-required a { color: var(--tp-purple); font-weight: 700; }
.tppet-back-link { display: inline-block; margin-bottom: 14px; color: var(--tp-purple); font-weight: 700; text-decoration: none; }

.tppet-no-items { text-align: center; color: #666; padding: 30px 0; }

/* ── Print: clean signature sheet, no site chrome ── */
@media print {
    .tppet-no-print, #wpadminbar, #main-header, .et-l--header, .et-l--footer, #main-footer { display: none !important; }
    .tppet-sheet-page { max-width: none; padding: 0; }
    .tppet-sheet-doc { box-shadow: none; border: none; border-radius: 0; padding: 0; }
    .tppet-sheet-table th { background: #fff !important; color: #000 !important; border-bottom: 2px solid #000; }
    .tppet-sheet-table td { border-bottom: 1px solid #999; }
    .tppet-sheet-table tr:nth-child(even) td { background: #fff !important; }
}

/* ── Mobile ── */
@media (max-width: 860px) {
    .tppet-layout { flex-direction: column; }
    .tppet-sidebar { flex: none; width: 100%; box-sizing: border-box; }
}
@media (max-width: 560px) {
    .tppet-form-grid { grid-template-columns: 1fr; }
    .tppet-petition { padding: 22px 16px; }
    .tppet-petition-title { font-size: 24px; }
    /* Extra bottom clearance so mobile browser toolbars never cover the
       submit button (same fix as the Sweepstakes modal). */
    .tppet-modal-box { padding: 26px 18px calc(70px + env(safe-area-inset-bottom, 0px)); border-radius: 16px; margin: 0 0 10px; }
    .tppet-modal-overlay { padding: 10px; }

    /* Archive table → cards (the poll listing's td:before trick). */
    .tppet-grid thead { display: none; }
    .tppet-grid, .tppet-grid tbody, .tppet-grid tr, .tppet-grid td { display: block; width: 100%; box-sizing: border-box; }
    .tppet-grid tr { border-bottom: 8px solid #f2eefa; padding: 8px 0; }
    .tppet-grid tbody td { border-bottom: none; padding: 6px 16px; }
    .tppet-grid tbody td:before {
        content: attr(data); display: inline-block; min-width: 110px;
        font-size: 11px; font-weight: 700; text-transform: uppercase;
        letter-spacing: 0.06em; color: #888;
    }
}
