/* ========================================
   CONCURSO GÁNATE UN TORO - ESTILOS CSS
   Paleta: #006838, #0D9A49, #D7DF23, #F5EB28, #F89621
======================================== */

/* === CSS Variables === */
:root {
    --verde-oscuro: #006838;
    --verde-medio: #0D9A49;
    --verde-lima: #D7DF23;
    --amarillo: #F5EB28;
    --naranja: #F89621;
    --blanco: #ffffff;
    --gris-claro: #f5f5f5;
    --gris-medio: #e0e0e0;
    --gris-texto: #666666;
    --negro: #333333;
    --error: #e53935;
    --shadow: 0 4px 20px rgba(0, 104, 56, 0.15);
    --shadow-hover: 0 8px 30px rgba(0, 104, 56, 0.25);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--verde-oscuro) 0%, var(--verde-medio) 50%, var(--verde-oscuro) 100%);
    min-height: 100vh;
    color: var(--negro);
    line-height: 1.6;
}

/* === Container === */
.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Header === */
.header {
    background: var(--blanco);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 30px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header-decoration {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, var(--verde-oscuro), var(--verde-medio), var(--verde-lima), var(--amarillo), var(--naranja));
}

.logo-container {
    margin-bottom: 15px;
}

.logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--verde-oscuro);
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: var(--gris-texto);
    font-size: 1rem;
    font-weight: 400;
}

/* === Form === */
.form {
    background: var(--blanco);
    padding: 30px;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    color: var(--negro);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    padding: 14px 16px;
    border: 2px solid var(--gris-medio);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--blanco);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--verde-medio);
    box-shadow: 0 0 0 4px rgba(13, 154, 73, 0.15);
}

.form-group input::placeholder {
    color: #aaa;
}

.form-group 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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-group select:disabled {
    background-color: var(--gris-claro);
    cursor: not-allowed;
}

/* Phone Input */
.phone-input {
    display: flex;
    align-items: center;
    border: 2px solid var(--gris-medio);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.phone-input:focus-within {
    border-color: var(--verde-medio);
    box-shadow: 0 0 0 4px rgba(13, 154, 73, 0.15);
}

.country-code {
    padding: 14px 12px;
    background: var(--gris-claro);
    font-weight: 500;
    color: var(--negro);
    border-right: 2px solid var(--gris-medio);
    white-space: nowrap;
}

.phone-input input {
    border: none;
    flex: 1;
    padding: 14px 16px;
}

.phone-input input:focus {
    box-shadow: none;
}

/* Error Message */
.error-message {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.form-group.error input,
.form-group.error .phone-input {
    border-color: var(--error);
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400;
}

.radio-label input {
    display: none;
}

.radio-custom {
    width: 22px;
    height: 22px;
    border: 2px solid var(--gris-medio);
    border-radius: 50%;
    position: relative;
    transition: var(--transition);
}

.radio-label input:checked+.radio-custom {
    border-color: var(--verde-medio);
}

.radio-label input:checked+.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: var(--verde-medio);
    border-radius: 50%;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.95rem;
}

.checkbox-label input {
    display: none;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--gris-medio);
    border-radius: 4px;
    position: relative;
    transition: var(--transition);
    margin-top: 2px;
}

.checkbox-label input:checked+.checkbox-custom {
    background: var(--verde-medio);
    border-color: var(--verde-medio);
}

.checkbox-label input:checked+.checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--blanco);
    font-weight: 700;
    font-size: 14px;
}

.terms-link {
    color: var(--verde-medio);
    text-decoration: underline;
}

.terms-link:hover {
    color: var(--verde-oscuro);
}

.gender-terms {
    align-items: flex-start;
}

.terms-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

@media (max-width: 600px) {
    .terms-group {
        justify-content: flex-start;
    }
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--naranja), #ff8c00);
    color: var(--blanco);
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(248, 150, 33, 0.4);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(248, 150, 33, 0.5);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    background: var(--gris-medio);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.referral-info {
    text-align: center;
    color: var(--blanco);
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* === Certificate Section === */
.certificate {
    background: var(--blanco);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.cert-header {
    background: linear-gradient(135deg, var(--verde-oscuro), var(--verde-medio));
    padding: 40px 30px;
    text-align: center;
    position: relative;
}

.cert-decoration {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--verde-lima), var(--amarillo), var(--naranja));
}

.cert-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
}

.cert-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--blanco);
    margin-bottom: 10px;
}

.cert-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    max-width: 400px;
    margin: 0 auto;
}

/* WhatsApp Section */
.cert-whatsapp {
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid var(--gris-medio);
}

.whatsapp-text {
    font-weight: 600;
    color: var(--negro);
    margin-bottom: 5px;
}

.whatsapp-desc {
    color: var(--gris-texto);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: var(--blanco);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.whatsapp-icon {
    width: 22px;
    height: 22px;
}

/* Share Section */
.cert-share {
    padding: 30px;
    text-align: center;
    background: var(--gris-claro);
}

.share-title {
    font-weight: 600;
    color: var(--verde-oscuro);
    margin-bottom: 5px;
}

.share-desc {
    color: var(--gris-texto);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.share-link-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.share-link {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--verde-medio);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--negro);
    background: var(--blanco);
}

.btn-copy {
    padding: 12px 16px;
    background: var(--verde-medio);
    color: var(--blanco);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-copy:hover {
    background: var(--verde-oscuro);
}

.btn-copy svg {
    width: 20px;
    height: 20px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-share {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    color: var(--blanco);
}

.btn-share svg {
    width: 18px;
    height: 18px;
}

.btn-share-whatsapp {
    background: #25D366;
}

.btn-share-facebook {
    background: #1877F2;
}

.btn-share-twitter {
    background: #000000;
}

.btn-share:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* QR Section */
.cert-qr-section {
    padding: 30px;
    display: flex;
    justify-content: center;
}

.qr-card {
    background: linear-gradient(135deg, var(--verde-oscuro), var(--verde-medio));
    border-radius: var(--radius);
    padding: 25px;
    text-align: center;
    max-width: 350px;
    position: relative;
}

.qr-header {
    margin-bottom: 15px;
}

.qr-badge {
    background: var(--amarillo);
    color: var(--verde-oscuro);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.qr-code {
    background: var(--blanco);
    padding: 15px;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin-bottom: 15px;
}

.qr-code canvas,
.qr-code img {
    display: block;
}

.qr-text {
    color: var(--blanco);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.qr-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    position: absolute;
    bottom: 15px;
    right: 15px;
}

/* Certificate Actions */
.cert-actions {
    display: flex;
    gap: 15px;
    padding: 20px 30px 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    max-width: 220px;
    justify-content: center;
}

.btn-action svg {
    width: 20px;
    height: 20px;
}

.btn-download {
    background: var(--verde-oscuro);
    color: var(--blanco);
}

.btn-share-img {
    background: var(--verde-medio);
    color: var(--blanco);
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--blanco);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--gris-texto);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--negro);
}

.modal-content h2 {
    color: var(--verde-oscuro);
    margin-bottom: 20px;
    padding-right: 30px;
}

.terms-content {
    font-size: 0.9rem;
    color: var(--gris-texto);
    line-height: 1.7;
    margin-bottom: 20px;
}

.terms-content ol {
    padding-left: 20px;
}

.terms-content li {
    margin-bottom: 10px;
}

.btn-accept {
    width: 100%;
    padding: 14px;
    background: var(--verde-medio);
    color: var(--blanco);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.btn-accept:hover {
    background: var(--verde-oscuro);
}

/* === Loading Overlay === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 104, 56, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--amarillo);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === Responsive === */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .header {
        padding: 25px 15px;
    }

    .title {
        font-size: 1.6rem;
    }

    .form {
        padding: 20px 15px;
    }

    .form-group input,
    .form-group select {
        padding: 12px 14px;
    }

    .radio-group {
        gap: 15px;
    }

    .cert-header {
        padding: 30px 20px;
    }

    .cert-title {
        font-size: 1.5rem;
    }

    .cert-whatsapp,
    .cert-share,
    .cert-qr-section {
        padding: 20px 15px;
    }

    .share-link-container {
        flex-direction: column;
    }

    .btn-copy {
        width: 100%;
    }

    .btn-action {
        max-width: 100%;
    }

    .qr-card {
        padding: 20px;
    }
}

/* === Candidate Banner === */
.candidate-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, var(--verde-oscuro), var(--verde-medio));
    border-radius: var(--radius);
    margin-top: 15px;
}

.candidate-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--amarillo);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.candidate-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: var(--blanco);
}

.candidate-name {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.candidate-position {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--verde-lima);
}

.candidate-party {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.party-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.party-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--amarillo);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

/* === Votes Input Field === */
.votes-row {
    grid-template-columns: 1fr;
    margin-bottom: 25px;
}

.votes-group {
    background: linear-gradient(135deg, var(--verde-lima), var(--amarillo));
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
}

.votes-group label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--verde-oscuro);
    margin-bottom: 12px;
}

.votes-group input {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 18px 20px;
    border: 3px solid var(--verde-medio);
    background: var(--blanco);
}

.votes-group input:focus {
    border-color: var(--verde-oscuro);
    box-shadow: 0 0 0 4px rgba(0, 104, 56, 0.2);
}

.votes-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--verde-oscuro);
    font-weight: 500;
}

/* === Certificate Candidate Section === */
.cert-candidate {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.cert-candidate-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--amarillo);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
}

.cert-candidate-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 25px;
}

.badge-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--blanco);
}

.badge-number {
    font-size: 1rem;
    font-weight: 600;
    color: var(--amarillo);
}

/* === Prediction Display === */
.cert-prediction {
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 25px;
    border-radius: var(--radius);
    margin-top: 15px;
    display: inline-block;
}

.prediction-label {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 5px;
}

.prediction-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--amarillo);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* === QR Card Candidate Info === */
.qr-candidate-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.qr-candidate-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--amarillo);
}

.qr-party-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qr-party-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.qr-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--amarillo);
}

/* === Campaign Footer === */
.campaign-footer {
    background: linear-gradient(90deg, var(--verde-oscuro), var(--verde-medio));
    color: var(--blanco);
    text-align: center;
    padding: 15px 20px;
    margin-top: 20px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.campaign-footer span {
    font-size: 0.85rem;
    color: var(--verde-lima);
}

.campaign-footer strong {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.cert-campaign {
    margin: 0;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* === Responsive Candidate Elements === */
@media (max-width: 480px) {
    .candidate-banner {
        flex-direction: column;
        text-align: center;
    }

    .candidate-info {
        align-items: center;
    }

    .candidate-name {
        font-size: 1.2rem;
    }

    .votes-group label {
        font-size: 1rem;
    }

    .votes-group input {
        font-size: 1.3rem;
        padding: 14px 16px;
    }

    .cert-candidate-photo {
        width: 80px;
        height: 80px;
    }

    .prediction-value {
        font-size: 1.5rem;
    }

    .campaign-footer strong {
        font-size: 0.95rem;
    }
}

/* === Print Styles === */
@media print {
    body {
        background: white;
    }

    .container {
        max-width: 100%;
    }

    .cert-actions,
    .cert-share .share-buttons,
    .share-link-container {
        display: none;
    }
}