/**
 * CubaOpina - Estilos del Formulario de Registro
 * Diseño moderno y responsive
 */

/* ==========================================================================
   CONTENEDOR PRINCIPAL
   ========================================================================== */

.co-registration-wrapper {
    max-width: 750px;
    margin: 40px auto;
    padding: 20px;
}

/* ==========================================================================
   ALERTAS
   ========================================================================== */

.co-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.co-alert-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.co-alert-success {
    background: #efe;
    border: 1px solid #cfc;
    color: #3c3;
}

.co-alert-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.co-alert-content {
    flex: 1;
    font-size: 15px;
    line-height: 1.5;
}

/* ==========================================================================
   FORMULARIO
   ========================================================================== */

.co-registration-form {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Header del formulario */
.co-form-header {
    text-align: center;
    margin-bottom: 35px;
}

.co-form-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px 0;
}

.co-form-header p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* ==========================================================================
   GRUPOS DE FORMULARIO
   ========================================================================== */

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

.co-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.co-label-icon {
    display: none; /* Ocultar iconos */
}

/* Inputs */
.co-form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.co-form-control:focus {
    outline: none;
    border-color: #0033a0;
    box-shadow: 0 0 0 3px rgba(0, 51, 160, 0.1);
}

.co-form-control::placeholder {
    color: #999;
}

/* Texto de ayuda */
.co-form-help {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 6px;
}

/* ==========================================================================
   FILAS DEL FORMULARIO
   ========================================================================== */

/* Por defecto, todos los campos en una columna */
.co-form-row {
    display: block;
}

.co-form-row-2col .co-form-group {
    width: 100%;
}

/* ==========================================================================
   CAMPO DE CONTRASEÑA
   ========================================================================== */

.co-password-wrapper {
    position: relative;
}

.co-password-wrapper .co-form-control {
    padding-right: 50px;
}

.co-toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    background-color: transparent !important;
    border: none;
    box-shadow: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    font-size: 22px;
    opacity: 0.5;
    transition: opacity 0.2s;
    line-height: 1;
    color: #333;
}

.co-toggle-password:hover {
    opacity: 0.8;
    background: transparent !important;
    box-shadow: none;
}

.co-toggle-password:focus {
    outline: none;
    opacity: 1;
    background: transparent !important;
    box-shadow: none;
}

.co-toggle-password:active {
    background: transparent !important;
    box-shadow: none;
}

.eye-icon {
    display: block;
    line-height: 1;
}

/* ==========================================================================
   reCAPTCHA
   ========================================================================== */

.co-recaptcha-wrapper {
    display: flex;
    justify-content: center;
    padding: 10px 0;
}

.co-recaptcha-wrapper .g-recaptcha {
    display: inline-block;
}

/* ==========================================================================
   BOTÓN DE ENVÍO
   ========================================================================== */

.co-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
}

.co-btn-primary {
    background: linear-gradient(135deg, #0033a0 0%, #0055cc 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 51, 160, 0.3);
}

.co-btn-primary:hover {
    background: linear-gradient(135deg, #002580 0%, #0044aa 100%);
    box-shadow: 0 6px 20px rgba(0, 51, 160, 0.4);
    transform: translateY(-2px);
}

.co-btn-primary:active {
    transform: translateY(0);
}

.co-btn-arrow {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.co-btn:hover .co-btn-arrow {
    transform: translateX(4px);
}

/* ==========================================================================
   FOOTER DEL FORMULARIO
   ========================================================================== */

.co-form-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.co-form-footer p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.co-form-footer a {
    color: #0033a0;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.co-form-footer a:hover {
    color: #002580;
    text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .co-registration-wrapper {
        padding: 15px;
        margin: 20px auto;
    }

    .co-registration-form {
        padding: 30px 20px;
    }

    .co-form-header h2 {
        font-size: 24px;
    }

    .co-form-header p {
        font-size: 14px;
    }

    /* Campos en columna en móvil */
    .co-form-row {
        flex-direction: column;
        gap: 0;
    }

    .co-form-row-2col .co-form-group {
        margin-bottom: 25px;
    }

    .co-form-control {
        padding: 12px 14px;
        font-size: 16px; /* Prevenir zoom en iOS */
    }

    .co-btn {
        padding: 14px 20px;
        font-size: 15px;
    }

    /* reCAPTCHA responsive */
    .co-recaptcha-wrapper .g-recaptcha {
        transform: scale(0.9);
        transform-origin: center;
    }
}

@media (max-width: 380px) {
    .co-recaptcha-wrapper .g-recaptcha {
        transform: scale(0.8);
    }
}

/* ==========================================================================
   ESTADOS DE VALIDACIÓN
   ========================================================================== */

.co-form-control:invalid:not(:placeholder-shown) {
    border-color: #fcc;
}

.co-form-control:valid:not(:placeholder-shown) {
    border-color: #cfc;
}

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

.co-btn.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.co-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

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

.co-form-control:focus-visible,
.co-btn:focus-visible,
.co-toggle-password:focus-visible {
    outline: 2px solid #0033a0;
    outline-offset: 2px;
}

/* Ocultar flechas de número en input de CI */
input[type="text"]#ci::-webkit-outer-spin-button,
input[type="text"]#ci::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */

.co-registration-form {
    animation: fadeInUp 0.4s ease;
}

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

/* ==========================================================================
   TEMA OSCURO (Opcional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .co-registration-form {
        background: #2c2c2c;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .co-form-header h2 {
        color: #f0f0f0;
    }

    .co-form-header p,
    .co-form-group label,
    .co-form-help {
        color: #b0b0b0;
    }

    .co-form-control {
        background: #1a1a1a;
        border-color: #444;
        color: #f0f0f0;
    }

    .co-form-control:focus {
        border-color: #4477cc;
        background: #252525;
    }

    .co-form-footer {
        border-top-color: #444;
    }

    .co-form-footer p {
        color: #999;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .co-registration-form {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .co-btn,
    .co-recaptcha-wrapper {
        display: none;
    }
}

/* ==========================================================================
   FIX CRÍTICO: BOTÓN AZUL DEL OJO
   ========================================================================== */

/* Sobrescribir estilos del tema con máxima especificidad */
#custom-registration-form .co-password-wrapper .co-toggle-password,
#custom-registration-form .co-password-wrapper button.co-toggle-password,
#custom-registration-form button.co-toggle-password,
.co-registration-form .co-password-wrapper .co-toggle-password,
.co-registration-form .co-password-wrapper button.co-toggle-password,
.co-password-wrapper .co-toggle-password,
button.co-toggle-password {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    position: absolute !important;
    right: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    cursor: pointer !important;
    font-size: 22px !important;
    opacity: 0.5 !important;
    color: #333 !important;
    line-height: 1 !important;
}

/* Todos los estados del botón */
#custom-registration-form .co-toggle-password:hover,
#custom-registration-form .co-toggle-password:focus,
#custom-registration-form .co-toggle-password:active,
.co-toggle-password:hover,
.co-toggle-password:focus,
.co-toggle-password:active,
button.co-toggle-password:hover,
button.co-toggle-password:focus,
button.co-toggle-password:active {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    opacity: 0.8 !important;
}

/* El ojo debe verse bien */
.co-toggle-password .eye-icon,
button.co-toggle-password .eye-icon {
    display: inline-block !important;
    font-style: normal !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

/* ==========================================================================
   FIX: OCULTAR <p> VACÍOS
   ========================================================================== */

/* Ocultar cualquier párrafo vacío que aparezca */
.co-password-wrapper + p:empty,
.co-form-group p:empty,
.co-registration-form p:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    line-height: 0 !important;
}

/* ==========================================================================
   FIX: OJO COMO SPAN (NO BUTTON) + ALTURA FIJA
   ========================================================================== */

.co-password-wrapper {
    position: relative;
    min-height: 50px; /* Evita saltos al mostrar errores */
}

/* Span del ojo - sobrescribir cualquier estilo de boton */
span.co-toggle-password,
.co-password-wrapper span.co-toggle-password {
    display: inline-block !important;
    position: absolute !important;
    right: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    cursor: pointer !important;
    font-size: 22px !important;
    opacity: 0.5 !important;
    line-height: 1 !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    transition: opacity 0.2s !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
}

span.co-toggle-password:hover {
    opacity: 0.8 !important;
}

/* Form group con altura minima para evitar saltos */
.co-form-group {
    margin-bottom: 25px;
    position: relative;
}

/* Error message fuera del wrapper */
.co-form-group .co-error-message {
    display: block;
    color: #c33;
    font-size: 13px;
    margin-top: 6px;
    position: relative;
}

.co-password-wrapper {
    position: relative;
}

.co-password-wrapper .co-form-control {
    padding-right: 50px;
}

.co-toggle-password {
    position: absolute !important;
    right: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    cursor: pointer !important;
    font-size: 18px !important;
    opacity: 0.5 !important;
    transition: opacity 0.2s !important;
    user-select: none !important;
    color: #666 !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
}

.co-toggle-password::before {
    content: "\f06e"; /* fa-eye */
}

.co-password-wrapper input[type="text"] + .co-toggle-password::before {
    content: "\f070"; /* fa-eye-slash */
}

.co-toggle-password:hover {
    opacity: 0.8 !important;
}

/* Altura uniforme */
.co-form-control {
    height: 48px !important;
    padding: 12px 14px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
}

.co-password-wrapper .co-form-control {
    padding-right: 50px !important;
}
