@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #0056b3;
    --primary-dark: #003d80;
    --accent: #009688;
    --bg: #f4f7fa;
    --white: #ffffff;
    --text: #333333;
    --text-light: #6b7280;
    --danger: #ef4444;
}

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

body.login-body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

#site-navbar {
    flex-shrink: 0;
}

.login-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px 16px;
}

.login-card {
    width: min(460px, 92vw);
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 86, 179, 0.12);
    padding: 24px 28px 22px;
    text-align: center;
    animation: loginCardFadeInUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.logo-box {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.login-logo {
    /* El logo de Farmacorp es cuadrado (2000x2000). El tope de alto de 60px
       venia del logo horizontal anterior y lo achicaba a 60x60: en el telefono
       se veia diminuto. Ahora el tope acompana al ancho. */
    width: min(150px, 42vw);
    height: auto;
    max-height: 150px;
    object-fit: contain;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.input-label {
    display: block;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
    background: #f9fafb;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.12);
    background: #ffffff;
}

.input-group.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
    background: #fff1f2;
    animation: shake 0.25s ease-in-out;
}

.input-icon {
    color: var(--primary);
    font-size: 1.1rem;
}

#loginCi {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text);
}

.error-message {
    text-align: left;
    font-size: 0.82rem;
    color: var(--danger);
    margin-top: 8px;
    min-height: 18px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

.primary-btn {
    width: 100%;
    margin-top: 14px;
    padding: 14px 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:disabled {
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.primary-btn.is-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    pointer-events: none;
}

.button-loading-spinner {
    width: 1em;
    height: 1em;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    animation: buttonSpin 0.75s linear infinite;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 86, 179, 0.2);
}

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

.link-btn {
    margin-top: 10px;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
}

@keyframes loginCardFadeInUp {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shake {
    0% { transform: translateX(0); }
    30% { transform: translateX(-4px); }
    60% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

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

@media (max-width: 480px) {
    .login-wrapper {
        padding: 4px 16px 12px;
    }

    .login-logo {
        width: min(190px, 56vw);
        max-height: 190px;
    }

    .login-card {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .login-title {
        font-size: 1.4rem;
    }
}

/* OTP modal */
body.otp-open {
    overflow: hidden;
}

.otp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 500000;
}

.otp-modal-overlay.show {
    display: flex;
}

.otp-modal {
    width: min(420px, 92vw);
    background: #ffffff;
    border-radius: 18px;
    padding: 26px 24px 22px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
    position: relative;
    text-align: center;
}

.otp-modal h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.otp-message {
    font-size: 0.92rem;
    color: #475569;
    margin-bottom: 18px;
}

.otp-input-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.otp-input {
    width: 160px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 6px;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
}

.otp-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
}

.otp-error {
    min-height: 18px;
    font-size: 0.85rem;
    color: var(--danger);
    margin-bottom: 12px;
}

.otp-verify-btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.otp-verify-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 86, 179, 0.2);
}

.otp-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
}

@media (max-width: 480px) {
    .otp-modal {
        padding: 22px 18px 18px;
    }

    .otp-input {
        width: 140px;
        font-size: 1.2rem;
        letter-spacing: 4px;
    }
}

/* ----------------------------------------------------------------------------
 * Modal "Portal incorrecto" — se muestra cuando el BFF detecta que el CI
 * pertenece a una cuenta de médico (código `doctor_account_in_patient_portal`)
 * y redirige al usuario al portal médico (doc.testingeracuan.com).
 * Reutiliza la base .otp-modal-overlay/.otp-modal/.otp-close para mantener la
 * estética del modal de OTP; sólo añade los estilos específicos de mensaje
 * informativo y la barra de acciones (link primario + cancelar).
 * -------------------------------------------------------------------------- */
.doctor-portal-modal .doctor-portal-message {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 6px 0 18px;
}

.doctor-portal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.doctor-portal-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 100%);
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.doctor-portal-go:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.25);
}

.doctor-portal-cancel {
    width: 100%;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.doctor-portal-cancel:hover {
    background: #f1f5f9;
}
