/* =====================================
   SONDEVA ENCUESTA - ESTILO MINIMALISTA
   Colores: Azul Marino + Verde Agua (Teal)
   ===================================== */

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

:root {
    /* Colores Sondeva */
    --primary: #1e3a8a;        /* Azul marino oscuro */
    --primary-light: #3b82f6;  /* Azul */
    --accent: #14b8a6;          /* Verde agua / Teal */
    --accent-dark: #0f766e;     /* Teal oscuro */

    /* Neutrales */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Estados */
    --success: #10b981;
    --error: #ef4444;

    /* Espaciado */
    --spacing: 1.5rem;

    /* Transiciones */
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--gray-900);
    line-height: 1.5;
}

/* ===================================
   CONTAINER
   =================================== */

.container {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 100%;
    padding: 2.5rem 2rem;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

/* ===================================
   PROGRESS
   =================================== */

.progress-container {
    margin-bottom: 2.5rem;
}

.progress-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%);
    transition: width var(--transition);
    border-radius: 2px;
}

.progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* ===================================
   STEPS
   =================================== */

.step {
    display: none;
    flex-direction: column;
    flex: 1;
    animation: fadeIn 0.4s ease-out;
}

.step.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

/* ===================================
   INPUTS & SELECT
   =================================== */

input[type="text"],
input[type="tel"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition);
    margin-bottom: 0.5rem;
    background: var(--white);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234b5563' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===================================
   OPTIONS (RADIO BUTTONS)
   =================================== */

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.option-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--white);
}

.candidate-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gray-200);
    flex-shrink: 0;
}

.option-card:hover {
    border-color: var(--accent);
    background: var(--gray-50);
}

.option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.option-card input[type="radio"]:checked + .option-content {
    color: var(--accent-dark);
}

.option-card:has(input:checked) {
    border-color: var(--accent);
    background: rgba(20, 184, 166, 0.05);
    box-shadow: 0 0 0 1px var(--accent);
}

.option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.option-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-900);
}

.option-party {
    font-size: 0.8rem;
    color: var(--gray-600);
}

.option-text {
    font-size: 0.95rem;
    font-weight: 500;
}

/* ===================================
   CONDITIONAL FIELDS
   =================================== */

.conditional-field {
    margin-top: 1rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 100px;
    }
}

/* ===================================
   BUTTONS
   =================================== */

.btn-next,
.btn-back,
.btn-submit {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-next,
.btn-submit {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: var(--white);
    flex: 1;
}

.btn-next:hover,
.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(20, 184, 166, 0.3);
}

.btn-next:active,
.btn-submit:active {
    transform: translateY(0);
}

.btn-back {
    background: var(--gray-100);
    color: var(--gray-700);
    min-width: 100px;
}

.btn-back:hover {
    background: var(--gray-200);
}

.button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1.5rem;
}

/* ===================================
   ERROR MESSAGES
   =================================== */

.error-message {
    display: none;
    color: var(--error);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.error-message.show {
    display: block;
}

input.error,
select.error,
textarea.error {
    border-color: var(--error);
}

/* ===================================
   CHECKBOX & CHAR COUNTER
   =================================== */

.terms-checkbox {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 8px;
}

.terms-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.terms-checkbox input[type="checkbox"] {
    margin-top: 0.15rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.terms-checkbox span {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.char-counter {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ===================================
   MODALS
   =================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeInModal 0.3s ease-out;
}

.modal.hidden {
    display: none;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: scaleIn 0.4s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--white);
    font-weight: bold;
}

.error-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--error);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--white);
    font-weight: bold;
}

.modal-content h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.modal-content p {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

.modal-content h3 {
    font-size: 1.1rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.modal-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.modal-content ul li {
    margin-bottom: 0.375rem;
}

.btn-retry {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-retry:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
}

/* ===================================
   LOADING
   =================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 58, 138, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(20, 184, 166, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===================================
   UTILITIES
   =================================== */

.hidden {
    display: none !important;
}

/* ===================================
   RESPONSIVE - OPTIMIZADO PARA MÓVILES
   =================================== */

@media (max-width: 768px) {
    body {
        padding: 0;
        align-items: flex-start;
    }

    .container {
        min-height: 100vh;
        border-radius: 0;
        padding: 1.5rem 1.25rem;
        max-width: 100%;
    }

    .progress-container {
        margin-bottom: 2rem;
    }

    .question-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.25rem;
    }

    /* Inputs más grandes para táctil */
    input[type="text"],
    input[type="tel"],
    input[type="email"],
    select,
    textarea {
        padding: 1rem 1rem;
        font-size: 16px; /* Previene zoom en iOS */
        border-radius: 10px;
    }

    /* Opciones en columna en móvil */
    .options-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }

    .option-card {
        padding: 1rem 1.25rem;
        min-height: 52px; /* Área táctil mínima recomendada */
    }

    .option-name {
        font-size: 1rem;
    }

    .option-party {
        font-size: 0.85rem;
    }

    /* Botones en columna */
    .button-group {
        flex-direction: column-reverse;
        gap: 0.875rem;
        padding-top: 1.25rem;
    }

    .btn-next,
    .btn-back,
    .btn-submit {
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1.05rem;
        min-height: 48px; /* Área táctil mínima */
    }

    /* Modal más grande en móvil */
    .modal-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }

    .success-icon,
    .error-icon {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 1.25rem 1rem;
    }

    .question-title {
        font-size: 1.35rem;
    }

    .subtitle {
        font-size: 0.875rem;
    }

    input[type="text"],
    input[type="tel"],
    input[type="email"],
    select,
    textarea {
        font-size: 16px; /* Mantener para evitar zoom */
    }

    .option-card {
        padding: 0.875rem 1rem;
    }

    .option-name {
        font-size: 0.95rem;
    }

    .terms-checkbox {
        padding: 0.875rem;
    }

    .terms-checkbox span {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .terms-checkbox a {
        font-weight: 600;
    }
}

/* Optimización para iPhone SE y similares */
@media (max-width: 375px) {
    .container {
        padding: 1rem 0.875rem;
    }

    .question-title {
        font-size: 1.25rem;
    }

    .progress-container {
        margin-bottom: 1.5rem;
    }
}

/* Landscape en móviles */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        padding: 0.5rem;
    }

    .container {
        min-height: auto;
        padding: 1rem;
    }

    .question-title {
        font-size: 1.25rem;
        margin-bottom: 0.375rem;
    }

    .subtitle {
        margin-bottom: 0.875rem;
    }

    .progress-container {
        margin-bottom: 1rem;
    }

    .button-group {
        padding-top: 1rem;
    }

    .option-card {
        padding: 0.75rem 1rem;
    }
}

/* ===================================
   ACCESIBILIDAD
   =================================== */

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================
   ANIMACIÓN ROCKET PARA BIENVENIDA
   =================================== */

.rocket-icon {
    display: inline-block;
    font-size: 4rem;
    animation: rocketLaunch 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(20, 184, 166, 0.3));
}

@keyframes rocketLaunch {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    10% {
        transform: translateY(-5px) rotate(-3deg);
    }
    20% {
        transform: translateY(-10px) rotate(3deg);
    }
    30% {
        transform: translateY(-5px) rotate(-2deg);
    }
    40% {
        transform: translateY(-15px) rotate(2deg) scale(1.05);
    }
    50% {
        transform: translateY(-20px) rotate(0deg) scale(1.1);
    }
    60% {
        transform: translateY(-15px) rotate(-2deg) scale(1.05);
    }
    70% {
        transform: translateY(-10px) rotate(2deg);
    }
    80% {
        transform: translateY(-5px) rotate(-1deg);
    }
    90% {
        transform: translateY(0) rotate(1deg);
    }
}

.welcome-glow {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(20, 184, 166, 0.2);
    }
    50% {
        box-shadow: 0 0 25px rgba(20, 184, 166, 0.4), 0 0 40px rgba(20, 184, 166, 0.2);
    }
}

/* Build trigger */
