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

:root {
    --black: #1A1A1A;
    --charcoal: #333333;
    --gray-dark: #4D4D4D;
    --gray: #6E6E6E;
    --gray-light: #B0B0B0;
    --bg: #F5F5F5;
    --white: #FFFFFF;
    --text-dark: #1A1A1A;
    --success: #2D7A3E;
    --error: #ff3475;
    --border: #DCDCDC;
    --accent: #2457D9;
    --accent-dark: #163C99;
    --accent-mid: #3D6EE0;
    --accent-light: #7098EC;
    --accent-tint: #E4ECFB;
}

body {
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--bg);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--black) 0%, var(--charcoal) 100%);
    color: var(--white);
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.header-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    width: 64px;
    height: 64px;
    padding: 0;
    border-radius: 10px;
    margin-bottom: 14px;
}

.header-logo {
    height: 48px;
    width: 48px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 14px;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

/* Header simplificado (form.html): regresar + logo + título en una fila */
.header-simple {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    text-align: left;
    padding: 16px 20px;
}

.header-title-group {
    min-width: 0;
}

.header-simple .header-subtitle {
    max-width: none;
    margin: 4px 0 0 0;
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.9;
}

.header-simple .header-logo-wrap {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
    padding: 0;
}

.header-simple .header-logo {
    height: 36px;
    width: 36px;
}

.header-simple h1 {
    font-size: 20px;
    margin-bottom: 0;
}

.header-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
    text-decoration: none;
    font-size: 20px;
    flex-shrink: 0;
    transition: background 0.3s;
}

.header-back:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Form Styles */
.form-section {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.form-section > .btn {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label:not(.radio-option):not(.question-title) {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 15px;
}

.form-group.required > label::after,
.form-group.required .question-title::after {
    content: " *";
    color: var(--error);
}

.form-group input,
.form-group select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group select {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gray);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

/* Artículo tipo blog/noticia (index.html, faqs.html) */
.story-kicker {
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
}

.story-title {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--black);
    margin-bottom: 18px;
}

.story-lead {
    font-size: 19px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--charcoal);
    margin-bottom: 16px;
}

.story-body {
    font-size: 16px;
    line-height: 1.75;
    color: var(--text-dark);
    margin-bottom: 18px;
}

.story-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: var(--accent-tint);
    border-radius: 10px;
    padding: 18px 10px;
    margin: 26px 0;
}

.story-stat {
    text-align: center;
}

.story-stat-icon {
    display: block;
    width: 50px;
    height: 50px;
    margin: 0 auto 6px;
}

.story-stat strong {
    display: block;
    font-size: 21px;
    font-weight: 800;
    color: var(--accent-dark);
}

.story-stat span {
    font-size: 14px;
    color: var(--gray-dark);
    line-height: 1.4;
}

.story-subhead {
    font-size: 20px;
    font-weight: 700;
    color: var(--black);
    margin: 30px 0 16px;
}

.story-points {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 22px;
}

.story-point {
    padding-left: 16px;
    border-left: 3px solid var(--accent);
}

.story-point-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.story-point strong {
    display: block;
    font-size: 16px;
    color: var(--black);
    margin-bottom: 4px;
}

.story-point-header strong {
    margin-bottom: 0;
}

.story-point p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-dark);
    margin: 0;
}

.story-inline-link {
    display: inline-block;
    font-size: 14px;
    color: var(--accent);
    text-decoration: underline;
    margin-bottom: 4px;
}

.story-inline-link:hover {
    color: var(--accent-dark);
}

.story-cta-line {
    text-align: center;
    font-size: 16px;
    color: var(--text-dark);
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.story-cta-line strong {
    display: block;
    font-size: 19px;
    color: var(--accent-dark);
    margin-top: 6px;
}

/* Mapa */
.map-wrap {
    margin: 25px 0;
    text-align: center;
}

.map-wrap img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Radio Buttons */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.radio-option:hover {
    background: #FAFAFA;
    border-color: var(--gray);
}

.radio-option.selected {
    background: var(--accent-tint);
    border-color: var(--accent);
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 14px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.radio-label {
    flex: 1;
}

.radio-label p {
    margin: 4px 0 0 0;
    font-size: 16px;
    font-weight: 400;
    color: var(--text-dark);
}

.radio-label strong {
    display: block;
    margin-bottom: 4px;
    color: var(--black);
}

.radio-option.selected .radio-label strong {
    color: var(--accent-dark);
}

/* Icono circular de cada pregunta */
.question-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.question-header .question-title {
    margin-bottom: 0;
}

.question-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
}

/* Buttons */
.btn {
    display: block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--black);
    color: var(--white);
}

.btn-primary:hover {
    background: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-accent {
    background: var(--accent);
    color: var(--white);
}

.btn-accent:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 87, 217, 0.35);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #C9C9C9;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
    vertical-align: middle;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.admin-link-temp {
    display: block;
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    color: var(--gray);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
}

.admin-link-temp:hover {
    color: var(--black);
}

/* Honeypot anti-bot: invisible para personas, visible para bots que auto-rellenan */
.campo-oculto-bot {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Messages */
.message {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.message.success {
    background: #E8F5E9;
    color: var(--success);
    border-left: 4px solid var(--success);
}

.message.error {
    background: #FFEBEE;
    color: var(--error);
    border-left: 4px solid var(--error);
}

/* Dashboard Table */
.dashboard {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.filters select,
.filters input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.filters select {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filters-tabla {
    margin-top: 35px;
}

.stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card,
.stat-card-wide {
    position: relative;
    flex: 0 1 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 150px;
    border-radius: 8px;
    text-align: center;
}

.stat-card {
    background: linear-gradient(135deg, var(--black) 0%, var(--charcoal) 100%);
    color: var(--white);
    padding: 20px;
}

@media (min-width: 480px) {
    .stat-card,
    .stat-card-wide {
        flex-basis: calc(50% - 7.5px);
        max-width: calc(50% - 7.5px);
    }
}

@media (min-width: 700px) {
    .stat-card,
    .stat-card-wide {
        flex-basis: calc(33.333% - 10px);
        max-width: calc(33.333% - 10px);
    }
}

.stat-card-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--white);
    opacity: 0.55;
}

.stat-card.alt1 {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-mid) 100%);
}

.stat-card.alt2 {
    background: linear-gradient(135deg, var(--accent-mid) 0%, var(--accent-light) 100%);
}

.stat-card.alt3 {
    background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent-mid) 100%);
}

.stat-card.alt4 {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
}

.stat-card-wide {
    background: linear-gradient(135deg, var(--black) 0%, var(--charcoal) 100%);
    padding: 16px 20px;
    border: 1px solid var(--error);
}

.stat-card-wide-number {
    font-size: 24px;
    font-weight: 800;
    color: var(--error);
}

.stat-card-wide-label {
    font-size: 14px;
    color: var(--white);
    opacity: 0.9;
    margin-top: 2px;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 6px;
}

.stat-of {
    font-size: 17px;
    font-weight: 500;
    opacity: 0.85;
}

.stat-label {
    font-size: 14px;
    line-height: 1.35;
    opacity: 0.9;
}

.stats-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
}

.stats-title h2 {
    color: var(--black);
}

/* Gráfica de barras horizontal por colonia */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    overflow-x: auto;
    padding-right: 6px;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(0, 2.5fr) minmax(18px, 1fr) 34px;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    padding: 4px 6px;
    margin: 0 -6px;
    border-radius: 6px;
    transition: background 0.3s, box-shadow 0.3s;
}

.bar-row-highlight {
    background: var(--accent-tint);
    box-shadow: 0 0 0 2px var(--accent);
}

.bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-dark);
}

.bar-track {
    min-width: 0;
    background: var(--bg);
    border-radius: 4px;
    height: 14px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dark), var(--accent));
    border-radius: 4px;
    transition: width 0.3s;
}

.bar-count {
    text-align: right;
    font-weight: 600;
    color: var(--black);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    background: var(--black);
    color: var(--white);
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: #FAFAFA;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge.a {
    background: #E5E5E5;
    color: var(--charcoal);
}

.badge.b {
    background: var(--charcoal);
    color: var(--white);
}

.pill-danger {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--error);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    white-space: nowrap;
}

/* Share Widget */
.share-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.share-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--white);
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.share-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.share-btn:hover {
    transform: scale(1.08);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-header {
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 15px;
}

.modal-header h2 {
    font-size: 22px;
    color: var(--black);
}

.qr-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 20px;
    background: var(--bg);
    border-radius: 8px;
}

#qrCode {
    display: inline-flex;
    justify-content: center;
}

#qrCode img,
#qrCode canvas {
    display: block;
    margin: 0 auto;
}

.link-copy {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.link-copy input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
}

.link-copy-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.link-copy-actions button {
    flex: 1;
    padding: 10px 15px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.link-copy-actions button:hover {
    background: var(--accent-dark);
}

.link-copy-actions .btn-whatsapp-share {
    background: #25D366;
}

.link-copy-actions .btn-whatsapp-share:hover {
    background: #1DA851;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-dark);
}

/* Modal de confirmación de participación */
.confirmacion-modal {
    text-align: center;
}

/* Modal de validación de residencia (INE opcional, post-envío) */
.validacion-modal h2 {
    font-size: 20px;
    color: var(--black);
    margin-bottom: 12px;
}

.validacion-modal p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    margin-bottom: 20px;
}

.validacion-modal .form-group {
    margin-bottom: 15px;
}

.validacion-modal .btn {
    margin-bottom: 10px;
}

.validacion-modal .btn:last-child {
    margin-bottom: 0;
}

.ine-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ine-label-row label {
    margin-bottom: 0 !important;
}

.ine-ayuda-link {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.ine-ayuda-link:hover {
    color: var(--accent-dark);
}

.ine-ayuda-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-tint);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.ine-ejemplo-img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
    border-radius: 8px;
    margin-bottom: 20px;
}

.politica-link {
    display: block;
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: underline;
}

.politica-link:hover {
    color: var(--accent-dark);
}

.politica-texto p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    margin-bottom: 14px;
}

.confirmacion-icon {
    font-size: 44px;
    margin-bottom: 10px;
}

.confirmacion-modal h2 {
    font-size: 22px;
    color: var(--black);
    margin-bottom: 15px;
}

.confirmacion-modal p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.participacion-id {
    background: var(--accent-tint);
    border-radius: 8px;
    padding: 14px;
    margin: 20px 0;
}

.participacion-id span {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.participacion-id strong {
    font-size: 20px;
    color: var(--accent-dark);
    letter-spacing: 1px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state p {
    margin-bottom: 20px;
}

.question-title {
    color: var(--black);
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 22px;
    }

    .form-section,
    .dashboard {
        padding: 20px;
    }

    .story-title {
        font-size: 22px;
    }

    .story-lead {
        font-size: 17px;
    }

    .story-stats {
        gap: 6px;
        padding: 16px 6px;
    }

    .story-stat strong {
        font-size: 17px;
    }

    .story-stat span {
        font-size: 12px;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .share-btn {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 10px;
    }

    .bar-row {
        font-size: 12px;
    }
}
