/**
 * Shared split-screen shell + animations for auth pages
 * (login, register, forgot-password, reset-password, verify-2fa)
 */

html, body {
    height: 100%;
}

body {
    margin: 0;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    background: var(--bg-page);
}

/* ==================== Brand Panel (left side, lg+ only) ==================== */
.auth-brand-panel {
    position: relative;
    width: 46%;
    flex-shrink: 0;
    display: flex;
    background: var(--primary-gradient);
    overflow: hidden;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

/* Admin-uploaded feature image: the actual background-image (a brand-color
   gradient layered over the photo, so text/shapes stay legible) is set
   inline per-page since it's a dynamic PHP value - this class only adds
   the sizing/positioning, which is static and belongs in CSS. */
.auth-brand-panel.has-feature-image {
    background-size: cover;
    background-position: center;
}

.auth-brand-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--text-white);
    max-width: 380px;
    animation: authFadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-brand-content img {
    max-height: 90px;
    max-width: 240px;
    object-fit: contain;
    margin-bottom: 1.5rem;
    animation: authScaleIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.auth-brand-content .auth-brand-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: block;
    animation: authScaleIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

/* style.css sets a global h1/h2/h3 color (dark gray) that, as a rule
   directly matching the element, wins over the white inherited from
   .auth-brand-content - so headings here need their own explicit override. */
.auth-brand-content h1,
.auth-brand-content h2,
.auth-brand-content h3 {
    color: var(--text-white) !important;
}

.auth-brand-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.auth-brand-content p {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.6;
    margin: 0;
}

/* "What happens next" step guide - replaces a plain paragraph with a short,
   scannable list of the user's next actions (login/register brand panels only). */
.auth-steps {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-top: 1.75rem;
}

.auth-step {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-lg, 12px);
    padding: 0.75rem 1.125rem;
    backdrop-filter: blur(4px);
    animation: authFadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.auth-step:nth-child(1) { animation-delay: 0.15s; }
.auth-step:nth-child(2) { animation-delay: 0.3s; }
.auth-step:nth-child(3) { animation-delay: 0.45s; }

.auth-step-num {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.auth-step-text {
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0.95;
}

.auth-step-text strong {
    font-weight: 600;
}

/* Decorative floating shapes */
.auth-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.auth-shape-1 {
    width: 280px;
    height: 280px;
    top: -80px;
    right: -80px;
    animation: authFloat 9s ease-in-out infinite;
}

.auth-shape-2 {
    width: 180px;
    height: 180px;
    bottom: -40px;
    left: -40px;
    animation: authFloat 7s ease-in-out infinite 1s;
}

.auth-shape-3 {
    width: 100px;
    height: 100px;
    bottom: 30%;
    right: 10%;
    background: rgba(255, 255, 255, 0.12);
    animation: authFloat 6s ease-in-out infinite 0.5s;
}

/* ==================== Form Panel (right side) ==================== */
.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    overflow-y: auto;
}

.auth-form-wrapper {
    max-width: 420px;
    width: 100%;
    animation: authFadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.auth-form-wrapper.auth-form-wide {
    max-width: 460px;
}

/* Compact header shown only when the brand panel is hidden (below lg) */
.auth-mobile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-mobile-header img {
    max-height: 64px;
    max-width: 200px;
    object-fit: contain;
    margin-bottom: 0.75rem;
}

.auth-mobile-header .auth-brand-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    display: block;
}

.auth-mobile-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.auth-mobile-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.auth-form-wrapper .form-floating label {
    color: var(--text-secondary);
}

.auth-form-wrapper h1.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.auth-form-wrapper p.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.auth-form-wrapper .form-control:focus,
.auth-form-wrapper .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem var(--primary-soft);
}

.auth-form-wrapper .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-auth-submit {
    background: var(--primary-gradient);
    border: none;
    padding: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-white) !important;
    border-radius: var(--radius);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-white) !important;
}

.btn-auth-submit:active {
    transform: translateY(0) scale(0.98);
}

.btn-auth-outline {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 20px;
    font-weight: 600;
    border-radius: var(--radius);
    background: transparent;
    transition: all 0.2s ease;
}

.btn-auth-outline:hover {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.auth-form-wrapper .alert {
    border-radius: var(--radius);
    border: none;
    animation: authFadeInUp 0.3s ease;
}

.auth-form-wrapper a.auth-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-form-wrapper a.auth-link:hover {
    color: var(--secondary-color);
}

.auth-footer {
    margin-top: 2rem;
}

/* Shake animation - trigger by toggling this class on validation errors */
.auth-shake {
    animation: authShake 0.4s ease;
}

/* Success icon pop-in (forgot-password / reset-password / 2fa confirmations) */
.auth-success-icon {
    animation: authScaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==================== Keyframes ==================== */
@keyframes authFadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes authScaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes authFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-15px, 20px) scale(1.05); }
}

@keyframes authShake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-8px); }
    40%, 60% { transform: translateX(8px); }
}

/* ==================== Responsive ==================== */
@media (max-width: 991.98px) {
    .auth-brand-panel {
        display: none !important;
    }

    .auth-form-panel {
        padding: 2rem 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand-content,
    .auth-brand-content img,
    .auth-brand-content .auth-brand-icon,
    .auth-form-wrapper,
    .auth-shape,
    .auth-success-icon,
    .auth-step {
        animation: none !important;
    }
}

/* ==================== Language Switcher ==================== */
.auth-language-switcher {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 50;
}

[dir="rtl"] .auth-language-switcher {
    right: auto;
    left: 1.25rem;
}

.auth-lang-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary, #1a1a1a);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-size: 1.1rem;
    transition: var(--transition-smooth, all 0.2s ease);
}

.auth-lang-btn:hover {
    color: var(--text-primary, #1a1a1a);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
