/* ============================================
   Auth Layout — Dorevo Institute
   ============================================ */

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1f28 0%, #1e4459 42%, #6a102f 100%);
    position: relative;
    overflow: hidden;
}

/* Background image via --banner variable (falls back to fondo.png) */
body::before {
    content: "";
    position: absolute;
    inset: -2%;
    background: var(--banner, url("../img/fondo.webp")) center/cover no-repeat;
    filter: saturate(1.05) contrast(1.02);
    transform: scale(1.04);
    z-index: 0;
}

/* Gradient overlay — same as landing page */
body::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(15, 31, 40, 0.82) 0%,
        rgba(106, 16, 47, 0.66) 40%,
        rgba(60, 10, 30, 0.58) 70%,
        rgba(15, 31, 40, 0.78) 100%
    );
    z-index: 1;
}

/* ── Auth Container ────────────────────────── */
.auth-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 480px;
    padding: 1.5rem;
    max-height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(106,16,47,0.3) transparent;
}

.auth-container::-webkit-scrollbar {
    width: 6px;
}

.auth-container::-webkit-scrollbar-track {
    background: transparent;
}

.auth-container::-webkit-scrollbar-thumb {
    background-color: rgba(106,16,47,0.3);
    border-radius: 3px;
}

.auth-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(106,16,47,0.5);
}

@media (max-width: 480px) {
    .auth-container {
        padding-top: 3.5rem;
        padding-bottom: 2rem;
    }
    .auth-container .auth-card {
        padding: 1.5rem 1rem !important;
    }
}

/* ── Auth Card ─────────────────────────────── */
.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2.75rem 2.5rem;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.02),
        0 12px 24px rgba(0, 0, 0, 0.06),
        0 32px 64px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.3s ease;
    width: 100%;
}

.auth-card:hover {
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.02),
        0 16px 32px rgba(0, 0, 0, 0.08),
        0 40px 80px rgba(0, 0, 0, 0.14);
}

/* ── Logo Area ─────────────────────────────── */
.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo img {
    height: 40px;
    width: auto;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.auth-logo img:hover {
    opacity: 1;
}

.auth-subtitle {
    color: var(--color-text-muted, #6B7280);
    font-size: 0.9rem;
    font-weight: 400;
    margin: 1.25rem 0 0;
}

/* ── Inputs ────────────────────────────────── */
.input-custom {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--color-surface-alt, #F0EFEB);
    border: 1.5px solid var(--color-border, #E5E4E0);
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--color-text, #1F2937);
    transition: all 0.2s ease;
    outline: none;
}

.input-custom:focus {
    background: #ffffff;
    border-color: var(--color-coral, #6A102F);
    box-shadow: 0 0 0 3px rgba(106,16,47,0.1);
}

.input-custom::placeholder {
    color: #9ca3af;
}

.input-custom.is-invalid {
    border-color: var(--color-danger, #D64545);
    box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.1);
}

/* ── Password Toggle ───────────────────────── */
.password-toggle {
    position: relative;
}

.password-toggle input {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.password-toggle-btn:hover {
    color: #6b7280;
}

/* ── Primary Button ────────────────────────── */
.btn-auth-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--color-coral, #6A102F);
    color: #ffffff;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-auth-primary::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn-auth-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(106,16,47,0.35);
    background: var(--color-coral-dark, #C43549);
}

.btn-auth-primary:hover::before {
    opacity: 1;
}

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

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

/* ── Form Labels ───────────────────────────── */
.auth-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #374151;
}

.auth-label .required {
    color: var(--color-coral, #6A102F);
    margin-left: 0.125rem;
}

/* ── Links ─────────────────────────────────── */
.auth-link {
    color: var(--color-coral, #6A102F);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: var(--color-coral-dark, #C43549);
    text-decoration: underline;
}

.auth-link-accent {
    color: var(--color-coral, #6A102F);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-link-accent:hover {
    color: var(--color-coral-dark, #C43549);
    text-decoration: underline;
}

/* ── Divider ───────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: #d1d5db;
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ── Footer Text ───────────────────────────── */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f3f4f6;
    color: #6b7280;
    font-size: 0.9rem;
}

/* ── Alert ─────────────────────────────────── */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.auth-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.auth-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ── Home Link ──────────────────────────────── */
.auth-home-link {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.2s ease;
}

.auth-home-link:hover {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.95);
}

/* ── Language Selector ─────────────────────── */
.auth-lang-selector {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.auth-lang-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.875rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    color: rgba(255, 255, 255, 0.75);
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.auth-lang-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.95);
}

.auth-lang-selector.open .auth-lang-btn {
    border-color: rgba(255, 255, 255, 0.3);
}

.auth-lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.375rem;
    min-width: 155px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    z-index: 100;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.97);
    transition:
        opacity 0.15s ease,
        visibility 0.15s ease,
        transform 0.15s ease;
    pointer-events: none;
}

.auth-lang-selector.open .auth-lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.auth-lang-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.auth-lang-code {
    font-weight: 700;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.3);
    min-width: 20px;
}

.auth-lang-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.auth-lang-option.active {
    background: rgba(30, 68, 89, 0.5);
    color: #ffffff;
}

.auth-lang-option.active .auth-lang-code {
    color: rgba(255, 255, 255, 0.7);
}

/* ── Checkbox ──────────────────────────────── */
.auth-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--color-coral, #6A102F);
    cursor: pointer;
}

.auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #6b7280;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 480px) {
    .auth-container {
        padding: 1rem;
        padding-top: 3.5rem;
        padding-bottom: 2rem;
    }
    .auth-container .auth-card {
        padding: 1.5rem 1rem !important;
    }

    .auth-card {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }

    .auth-logo {
        margin-bottom: 1rem;
    }

    .auth-logo img {
        height: 32px;
        width: auto;
    }

    .auth-subtitle {
        font-size: 0.82rem;
        margin-top: 0.75rem;
    }

    .auth-label {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }

    .input-custom {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    .btn-auth-primary {
        padding: 0.7rem 1.25rem;
        font-size: 0.85rem;
    }

    .auth-checkbox-label {
        font-size: 0.8rem;
    }

    .auth-divider {
        margin: 1rem 0;
    }

    .auth-divider span {
        font-size: 0.75rem;
    }

    .auth-footer {
        font-size: 0.8rem;
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .auth-home-link {
        top: 0.5rem;
        left: 0.5rem;
        width: 34px;
        height: 34px;
    }

    .auth-lang-selector {
        top: 0.5rem;
        right: 0.5rem;
    }

    .auth-lang-btn span:last-child {
        display: none;
    }
}

@media (max-height: 700px) {
    .auth-card {
        padding: 1.75rem 2rem;
    }

    .auth-logo {
        margin-bottom: 0.75rem;
    }

    .auth-logo img {
        height: 32px;
    }

    .auth-subtitle {
        margin-top: 0.5rem;
    }

    .auth-label {
        margin-bottom: 0.3rem;
    }

    .input-custom {
        padding: 0.6rem 0.85rem;
    }

    .btn-auth-primary {
        padding: 0.7rem 1.25rem;
    }

    .auth-footer {
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .auth-divider {
        margin: 1rem 0;
    }
}

@media (max-height: 600px) {
    .auth-card {
        padding: 1.25rem 1.75rem;
    }

    .auth-logo {
        margin-bottom: 0.5rem;
    }

    .auth-logo img {
        height: 28px;
    }

    .input-custom {
        padding: 0.45rem 0.7rem;
        font-size: 0.8rem;
    }

    .btn-auth-primary {
        padding: 0.55rem 1rem;
        font-size: 0.85rem;
    }

    .auth-footer {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }

    .auth-divider {
        margin: 0.75rem 0;
    }
}
