/* ============================================================
   Auth Pages (Login, Register, Reset Password)
   Fullscreen gradient background, centered card.
   Uses brand CSS variables from branding.css.
   ============================================================ */

/* ---- Fullscreen Layout ---- */
body.auth-page {
    overflow: hidden; /* container scrolls internally */
}

body.auth-page .main-content-with-sidebar {
    margin-left: 0;
}

body.auth-page main.container {
    background: transparent;
    margin: 0;
    padding: 0;
    max-width: 100%;
}

body.auth-page footer {
    display: none;
}

.auth-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-gradient);
    padding: 1.25rem;
    z-index: 1;
    overflow-y: auto;
}

[data-bs-theme="dark"] .auth-container {
    background: linear-gradient(
        315deg,
        var(--brand-surface) 0%,
        var(--brand-surface-alt) 100%
    );
}

/* ---- Card ---- */
.auth-card {
    background: var(--brand-card);
    border-radius: var(--brand-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    max-width: 440px;
    width: 100%;
    margin: auto;
    animation: auth-slide-up 0.5s ease-out;
}

[data-bs-theme="dark"] .auth-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

@keyframes auth-slide-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Header (gradient bar) ---- */
.auth-header {
    background: var(--brand-gradient);
    color: #fff;
    padding: 2.5rem 2rem;
    text-align: center;
}

[data-bs-theme="dark"] .auth-header {
    background: linear-gradient(
        315deg,
        color-mix(in srgb, var(--brand-primary) 70%, black),
        color-mix(in srgb, var(--brand-accent) 70%, black)
    );
}

.auth-header h3 {
    margin: 0;
    font-weight: 700;
    font-size: 1.75rem;
    font-family: var(--brand-font-heading);
}

.auth-header p {
    margin: 0.5rem 0 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.auth-icon {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.auth-icon:hover {
    transform: scale(1.05);
}

.auth-icon i {
    font-size: 2rem;
}

/* ---- Body ---- */
.auth-body {
    padding: 2.5rem 2rem;
}

/* ---- Form Inputs ---- */
.auth-body .form-floating {
    margin-bottom: 1.25rem;
}

.auth-body .form-floating > .form-control {
    border-radius: var(--brand-radius-sm);
    border: 2px solid var(--brand-border);
    padding: 1.625rem 0.75rem 0.625rem;
    height: calc(3.75rem + 2px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-body .form-floating > .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.2rem var(--brand-glow);
}

.auth-body .form-floating > label {
    padding: 1rem 0.75rem;
    color: var(--brand-text-muted);
    font-size: 0.95rem;
}

/* ---- Password Toggle ---- */
.auth-password-wrapper {
    position: relative;
}

.auth-password-toggle {
    position: absolute;
    right: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--brand-text-muted);
    z-index: 10;
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0.25rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-password-toggle:hover {
    color: var(--brand-primary);
}

/* ---- Submit Button ---- */
.btn-auth {
    background: var(--brand-gradient);
    border: none;
    border-radius: var(--brand-radius-sm);
    padding: 0.85rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px var(--brand-glow);
    min-height: 2.75rem;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--brand-glow);
    color: #fff;
}

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

[data-bs-theme="dark"] .btn-auth {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* ---- Divider ---- */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--brand-text-muted);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--brand-border);
}

.auth-divider span {
    padding: 0 1rem;
    font-size: 0.9rem;
}

/* ---- Links ---- */
.auth-link {
    text-align: center;
    margin-top: 1.25rem;
}

.auth-link a {
    color: var(--brand-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-link a:hover {
    color: var(--brand-accent);
    text-decoration: underline;
}

/* ---- Validation ---- */
.auth-body .form-control.is-invalid,
.auth-body .form-select.is-invalid {
    border-color: var(--brand-error);
}

/* ---- Role Info (Register) ---- */
.auth-role-info {
    background: var(--brand-surface-alt);
    border-radius: var(--brand-radius-sm);
    padding: 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.auth-role-info strong {
    color: var(--brand-primary);
}

/* ---- Select fix for floating labels ---- */
.auth-body .form-floating > .form-select {
    border-radius: var(--brand-radius-sm);
    border: 2px solid var(--brand-border);
    height: calc(3.5rem + 2px);
    padding-top: 1.375rem;
    padding-bottom: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-body .form-floating > .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.2rem var(--brand-glow);
}

/* ---- Responsive ---- */
@media (max-width: 575.98px) {
    .auth-header {
        padding: 2rem 1.5rem;
    }
    .auth-body {
        padding: 2rem 1.5rem;
    }
    .auth-header h3 {
        font-size: 1.5rem;
    }
}
