/* ================================================================
   UnICA Auth Pages — Plataforma Unificada ICA
   Módulo ICA / modules/ica/views/site/
   ================================================================ */

/* Fuente */
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,400;0,6..12,500;0,6..12,600;0,6..12,700;0,6..12,800;0,6..12,900&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.unica-auth-body {
    font-family: 'Nunito Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: #fff;
}

/* ================================================================
   WRAPPER
   ================================================================ */
.unica-auth-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ================================================================
   PANEL IZQUIERDO — imagen de fondo (gradiente como fallback)
   ================================================================ */
.unica-left-panel {
    width: 42%;
    position: relative;
    overflow: hidden;
    /* Gradiente como fallback si la imagen no carga */
    background: linear-gradient(148deg,
        #1a6830 0%,
        #228040 22%,
        #2c9148 46%,
        #3daa54 68%,
        #57bc5c 84%,
        #6ecb60 100%
    );
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Variantes de fondo por página */
.unica-left-panel--login {
    background-image: url('/images/ica/fondo-izquierdo-login.png');
}

.unica-left-panel--recovery {
    background-image: url('/images/ica/fondo-recuperar-derecho.png');
}

/* Contenido del panel izquierdo */
.unica-left-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 32px 0;
    width: 100%;
    max-width: 480px;
}

.unica-logo-white {
    max-width: 280px;
    width: 100%;
    margin-bottom: 28px;
}

.unica-welcome-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.15;
    margin-bottom: 14px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.unica-welcome-subtitle {
    font-size: 1.05rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.55;
    max-width: 300px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Imagen de personas (login) */
.unica-left-people {
    width: 100%;
    max-width: 360px;
    margin-top: 20px;
    position: relative;
    z-index: 2;
    display: block;
}

/* ================================================================
   PANEL DERECHO — imagen de fondo + formulario
   ================================================================ */
.unica-right-panel {
    width: 58%;
    background: #ffffff;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Variantes de fondo por página */
.unica-right-panel--login {
    background-image: url('/images/ica/fondo-derecho-login.png');
}

.unica-right-panel--recovery {
    background-image: url('/images/ica/fondo-recuperar-izquierdo.png');
}

/* Contenido del formulario */
.unica-right-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 500px;
    padding: 48px 44px;
}

/* ================================================================
   LOGOTIPO (panel derecho — solo en login)
   ================================================================ */
.unica-logo-colored {
    max-width: 210px;
    display: block;
    margin: 0 auto 30px;
}

/* ================================================================
   ENCABEZADO DEL FORMULARIO
   ================================================================ */
.unica-form-title {
    font-size: 2rem;
    font-weight: 900;
    color: #1a5c31;
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.2;
}

.unica-form-subtitle {
    font-size: 0.95rem;
    color: #6b7280;
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ================================================================
   MENSAJES FLASH
   ================================================================ */
.unica-flash-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    margin-bottom: 18px;
}

.unica-flash-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    margin-bottom: 18px;
}

/* ================================================================
   CAMPOS DEL FORMULARIO
   ================================================================ */

/* Wrapper de campo */
.unica-field {
    margin-bottom: 18px;
}

/* Etiqueta */
.unica-field > label,
.unica-field .unica-label,
.unica-right-content label.control-label,
.unica-right-content .form-label {
    display: block;
    font-weight: 700;
    color: #1a5c31;
    font-size: 0.92rem;
    margin-bottom: 7px;
}

/* Input base */
.unica-input,
.unica-right-content .form-control {
    width: 100%;
    border: 2px solid #c5ddb3;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: #374151;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    font-family: inherit;
}

.unica-input:focus,
.unica-right-content .form-control:focus {
    border-color: #2e7d32;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}

.unica-input::placeholder,
.unica-right-content .form-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Errores de validación (Bootstrap + Yii2) */
.unica-input.is-invalid,
.unica-right-content .form-control.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: none !important;
}

.unica-right-content .invalid-feedback,
.unica-field-error {
    color: #ef4444;
    font-size: 0.82rem;
    margin-top: 4px;
    display: block;
}

/* Input con ícono de ojo (contraseña) */
.unica-input-wrap {
    position: relative;
}

.unica-input-wrap .unica-input,
.unica-input-wrap .form-control {
    padding-right: 46px;
}

.unica-eye-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #9ca3af;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.unica-eye-btn:hover {
    color: #4b5563;
}

/* ================================================================
   FILA RECUÉRDAME + OLVIDÉ
   ================================================================ */
.unica-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    margin-top: 4px;
}

.unica-checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.unica-checkbox-wrap input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #2e7d32;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
}

.unica-checkbox-wrap label {
    font-size: 0.9rem;
    color: #374151;
    cursor: pointer;
    font-weight: 500;
    margin: 0;
    line-height: 1;
}

.unica-forgot-link {
    font-size: 0.9rem;
    font-weight: 800;
    color: #1a5c31;
    text-decoration: none;
    white-space: nowrap;
}

.unica-forgot-link:hover {
    text-decoration: underline;
    color: #145228;
}

/* ================================================================
   BOTÓN PRINCIPAL
   ================================================================ */
.unica-btn-submit {
    display: block;
    width: 100%;
    background: #1a5c31;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.6px;
    transition: background 0.2s ease, transform 0.1s ease;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    line-height: 1.5;
}

.unica-btn-submit:hover {
    background: #145228;
    color: #ffffff;
    text-decoration: none;
}

.unica-btn-submit:active {
    transform: scale(0.99);
}

/* ================================================================
   WIDGET RECAPTCHA
   ================================================================ */
.unica-captcha-wrap {
    margin-bottom: 20px;
}

.unica-captcha-wrap .g-recaptcha,
.unica-captcha-wrap > div {
    border-radius: 8px;
    overflow: hidden;
}

/* ================================================================
   ENLACES INFERIORES
   ================================================================ */
.unica-bottom-links {
    text-align: center;
    margin-top: 20px;
}

.unica-bottom-links p {
    font-size: 0.92rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.unica-action-link {
    font-weight: 800;
    color: #1a5c31;
    text-decoration: none;
}

.unica-action-link:hover {
    text-decoration: underline;
    color: #145228;
}

.unica-back-link {
    display: block;
    font-size: 0.92rem;
    color: #1a5c31;
    text-decoration: none;
    font-weight: 600;
    margin-top: 10px;
}

.unica-back-link:hover {
    text-decoration: underline;
    color: #145228;
}

/* ================================================================
   OVERRIDES ESPECÍFICOS PARA YII2 ACTIVEFORM
   ================================================================ */

/* Eliminar margen por defecto de form-group de Yii2 */
.unica-right-content .mb-3 {
    margin-bottom: 18px !important;
}

/* Quitar el estilo de error rojo de Bootstrap por defecto y usar el nuestro */
.unica-right-content .has-error .form-control {
    border-color: #ef4444;
}

.unica-right-content .help-block {
    color: #ef4444;
    font-size: 0.82rem;
    margin-top: 4px;
}

/* Ajustar labels de ActiveForm */
.unica-right-content .field-loginform-username label,
.unica-right-content .field-loginform-password label,
.unica-right-content .field-forgotform-username label,
.unica-right-content label[for] {
    font-weight: 700;
    color: #1a5c31;
    font-size: 0.92rem;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 991px) {
    .unica-left-panel {
        display: none;
    }

    .unica-right-panel {
        width: 100%;
    }

    .unica-right-content {
        padding: 40px 24px;
    }
}

@media (max-width: 480px) {
    .unica-form-title {
        font-size: 1.6rem;
    }

    .unica-right-content {
        padding: 30px 16px;
    }

    .unica-remember-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
