/**
 * AUTH ALCHEMY - The Gateway to the Sanctum
 * ==========================================
 *
 * Where seekers present themselves at the threshold,
 * their credentials the key to hidden knowledge.
 *
 * "The password is not spoken, it is lived."
 */

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ═══════════════════════════════════════════════════════════════
   I. THE THRESHOLD - Page Foundation
   ═══════════════════════════════════════════════════════════════ */

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(145deg, #0d1625 0%, var(--void, #142239) 50%, #0a1220 100%);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Sacred geometry background */
.auth-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(243, 197, 64, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(165, 165, 194, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(173, 198, 204, 0.02) 0%, transparent 70%);
    pointer-events: none;
}

/* Subtle animated sigil pattern */
.auth-page::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5L35 15L45 15L37.5 22.5L40 32.5L30 27.5L20 32.5L22.5 22.5L15 15L25 15Z' fill='none' stroke='rgba(243,197,64,0.02)' stroke-width='0.5'/%3E%3C/svg%3E");
    opacity: 0.5;
    animation: drift 120s linear infinite;
    pointer-events: none;
}

@keyframes drift {
    from { background-position: 0 0; }
    to { background-position: 1000px 1000px; }
}

.auth-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    z-index: 1;
}

@media (min-width: 900px) {
    .auth-container {
        flex-direction: row;
    }
}

/* ═══════════════════════════════════════════════════════════════
   II. THE ATHANOR - Hero Panel
   ═══════════════════════════════════════════════════════════════ */

.auth-hero {
    padding: 3rem 2rem;
    color: var(--text-primary, #e8e6e1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

@media (min-width: 900px) {
    .auth-hero {
        flex: 1;
        padding: 4rem 3rem;
        max-width: 55%;
    }
}

.auth-hero__logo {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 3rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-transform: uppercase;
    color: var(--aurum, #F3C540);
    text-shadow: 0 0 40px rgba(243, 197, 64, 0.4);
}

.auth-hero__logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(243, 197, 64, 0.15) 0%, rgba(243, 197, 64, 0.08) 100%);
    border: 1px solid rgba(243, 197, 64, 0.25);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--aurum, #F3C540);
    box-shadow:
        0 0 30px rgba(243, 197, 64, 0.15),
        inset 0 0 20px rgba(243, 197, 64, 0.05);
    padding: 6px;
}

.auth-hero__logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-hero__tagline {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1.25rem;
    font-style: italic;
    color: var(--sage, #A6A397);
    margin-bottom: 3rem;
    line-height: 1.6;
    max-width: 500px;
}

.auth-hero__features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-hero__feature {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1.05rem;
    color: var(--text-secondary, rgba(232, 230, 225, 0.8));
    line-height: 1.5;
}

.auth-hero__feature-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: rgba(243, 197, 64, 0.08);
    border: 1px solid rgba(243, 197, 64, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--aurum, #F3C540);
    margin-top: 2px;
    padding: 4px;
}

.auth-hero__feature-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-hero__feature-icon svg {
    width: 16px;
    height: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   III. THE CRUCIBLE - Forms Panel
   ═══════════════════════════════════════════════════════════════ */

.auth-forms {
    background: linear-gradient(180deg, rgba(20, 34, 57, 0.95) 0%, rgba(13, 22, 37, 0.98) 100%);
    padding: 3rem 2rem;
    border-radius: 24px 24px 0 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(166, 163, 151, 0.1);
    border-bottom: none;
}

/* Decorative top border */
.auth-forms::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(243, 197, 64, 0.4), transparent);
}

@media (min-width: 900px) {
    .auth-forms {
        border-radius: 24px 0 0 24px;
        padding: 4rem 3rem;
        max-width: 480px;
        border: 1px solid rgba(166, 163, 151, 0.1);
        border-right: none;
    }

    .auth-forms::before {
        top: 10%;
        bottom: 10%;
        left: 0;
        right: auto;
        width: 1px;
        height: auto;
        background: linear-gradient(180deg, transparent, rgba(243, 197, 64, 0.4), transparent);
    }
}

.auth-forms__inner {
    max-width: 380px;
    margin: 0 auto;
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   IV. THE ELEMENTAL TABS
   ═══════════════════════════════════════════════════════════════ */

.form-tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(166, 163, 151, 0.08);
    padding: 0.375rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    border: 1px solid rgba(166, 163, 151, 0.1);
}

.form-tabs__tab {
    flex: 1;
    padding: 0.875rem 1.25rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--sage, #A6A397);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-tabs__tab:hover {
    color: var(--text-primary, #e8e6e1);
    background: rgba(166, 163, 151, 0.08);
}

.form-tabs__tab--active {
    background: rgba(243, 197, 64, 0.15);
    color: var(--aurum, #F3C540);
    border: 1px solid rgba(243, 197, 64, 0.2);
    box-shadow: 0 0 20px rgba(243, 197, 64, 0.1);
}

/* ═══════════════════════════════════════════════════════════════
   V. THE TRANSMUTATION FORMS
   ═══════════════════════════════════════════════════════════════ */

.auth-form {
    display: none;
    animation: fadeSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.auth-form--active {
    display: block;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-form__title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #e8e6e1);
    letter-spacing: 0.03em;
}

.auth-form__subtitle {
    font-family: 'Crimson Pro', Georgia, serif;
    color: var(--sage, #A6A397);
    margin-bottom: 2rem;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   VI. THE SACRED INPUTS
   ═══════════════════════════════════════════════════════════════ */

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-form .form-label {
    display: block;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary, #e8e6e1);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-form .form-input,
.auth-form .form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1rem;
    border: 1px solid rgba(166, 163, 151, 0.2);
    border-radius: 8px;
    background: rgba(20, 34, 57, 0.6);
    color: var(--text-primary, #e8e6e1);
    transition: all 0.3s ease;
}

.auth-form .form-input::placeholder {
    color: var(--sage, #A6A397);
    opacity: 0.7;
}

.auth-form .form-input:focus,
.auth-form .form-select:focus {
    outline: none;
    border-color: rgba(243, 197, 64, 0.5);
    box-shadow:
        0 0 0 3px rgba(243, 197, 64, 0.1),
        0 0 20px rgba(243, 197, 64, 0.1);
    background: rgba(20, 34, 57, 0.8);
}

.auth-form .form-input--error {
    border-color: #dc3545;
}

.auth-form .form-input--error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.auth-form .form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A6A397' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.auth-form .form-select option {
    background: #142239;
    color: #e8e6e1;
}

/* Password visibility toggle */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--sage, #A6A397);
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--aurum, #F3C540);
}

.password-wrapper .form-input {
    padding-right: 3rem;
}

/* ═══════════════════════════════════════════════════════════════
   VII. THE GOLDEN SUBMIT
   ═══════════════════════════════════════════════════════════════ */

.auth-form__submit {
    width: 100%;
    padding: 1rem 1.5rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--void, #142239);
    background: linear-gradient(135deg, var(--aurum, #F3C540) 0%, #d4a520 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow:
        0 4px 20px rgba(243, 197, 64, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    margin-top: 0.5rem;
}

.auth-form__submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow:
        0 8px 30px rgba(243, 197, 64, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.auth-form__submit:active:not(:disabled) {
    transform: translateY(0);
}

.auth-form__submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-form__submit--loading .btn-text {
    display: none;
}

.auth-form__submit .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(20, 34, 57, 0.3);
    border-top-color: var(--void, #142239);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.auth-form__submit--loading .spinner {
    display: block;
}

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

/* ═══════════════════════════════════════════════════════════════
   VIII. MESSAGES FROM THE AETHER
   ═══════════════════════════════════════════════════════════════ */

.auth-form__error {
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    color: #f8a5a5;
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 0.9rem;
    display: none;
}

.auth-form__error--visible {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: shake 0.4s ease;
}

.auth-form__error-icon {
    flex-shrink: 0;
    margin-top: 2px;
    color: #dc3545;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.auth-form__success {
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 8px;
    color: #81c995;
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 0.9rem;
    display: none;
}

.auth-form__success--visible {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Field validation */
.form-field-error {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 0.85rem;
    color: #f8a5a5;
    margin-top: 0.375rem;
    display: none;
}

.form-field-error--visible {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════
   IX. PASSWORD STRENGTH - The Philosopher's Stone
   ═══════════════════════════════════════════════════════════════ */

.password-strength {
    margin-top: 0.625rem;
    display: none;
}

.password-strength--visible {
    display: block;
}

.password-strength__bar {
    height: 4px;
    background: rgba(166, 163, 151, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.375rem;
}

.password-strength__fill {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.password-strength__fill--weak {
    width: 33%;
    background: linear-gradient(90deg, #dc3545, #dc3545);
}

.password-strength__fill--medium {
    width: 66%;
    background: linear-gradient(90deg, #ffc107, #f0ad00);
}

.password-strength__fill--strong {
    width: 100%;
    background: linear-gradient(90deg, rgba(243, 197, 64, 0.8), var(--aurum, #F3C540));
    box-shadow: 0 0 10px rgba(243, 197, 64, 0.3);
}

.password-strength__text {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 0.8rem;
    color: var(--sage, #A6A397);
}

/* ═══════════════════════════════════════════════════════════════
   X. THE PASSAGE - Footer Links
   ═══════════════════════════════════════════════════════════════ */

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(166, 163, 151, 0.1);
}

.auth-footer__text {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 0.95rem;
    color: var(--sage, #A6A397);
}

.auth-footer__link {
    color: var(--aurum, #F3C540);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.auth-footer__link:hover {
    text-shadow: 0 0 15px rgba(243, 197, 64, 0.5);
}

/* ═══════════════════════════════════════════════════════════════
   XI. RESPONSIVE TRANSMUTATIONS
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 899px) {
    .auth-hero {
        text-align: center;
        padding-bottom: 2rem;
    }

    .auth-hero__logo {
        justify-content: center;
        font-size: 2.25rem;
    }

    .auth-hero__tagline {
        margin-left: auto;
        margin-right: auto;
    }

    .auth-hero__features {
        display: none;
    }
}

@media (max-width: 480px) {
    .auth-forms {
        padding: 2rem 1.25rem;
    }

    .auth-hero {
        padding: 2rem 1.25rem;
    }

    .auth-hero__logo {
        font-size: 1.75rem;
    }

    .auth-hero__logo-icon {
        width: 44px;
        height: 44px;
    }

    .auth-form__title {
        font-size: 1.5rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   XII. UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════ */

.hidden {
    display: none !important;
}
