/* ============================================
   AUTH MODAL
   ============================================ */

/* Overlay */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.auth-overlay--visible {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.auth-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background-color: #141414;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 480px;
}

.auth-modal--open {
    transform: translateX(0);
}

/* Modal Header */
.auth-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    min-height: 56px;
    position: sticky;
    top: 0;
    background-color: #141414;
    z-index: 2;
}

.auth-modal__title {
    font-size: 0.875rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffffff;
}

.auth-modal__header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.875rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.auth-modal__close-btn,
.auth-modal__back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.auth-modal__close-btn:active,
.auth-modal__back-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

.auth-modal__back-btn--hidden,
.auth-modal__close-btn--hidden {
    visibility: hidden;
    pointer-events: none;
}

/* Spacer to balance header when only one button is visible */
.auth-modal__header-spacer {
    width: 36px;
    flex-shrink: 0;
}

/* ============================================
   AUTH SCREENS (each is a "view")
   ============================================ */
.auth-screen {
    display: none;
    flex-direction: column;
    flex: 1;
    padding: 0 20px 32px;
    animation: authFadeIn 0.3s ease both;
}

.auth-screen--active {
    display: flex;
}

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

/* ============================================
   SCREEN 1: LOGIN OPTIONS
   ============================================ */
.auth-options {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 1;
    gap: 12px;
    padding-bottom: 20px;
}

.auth-options__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 16px 20px;
    border-radius: 14px;
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    border: none;
    font-family: inherit;
}

.auth-options__btn:active {
    transform: scale(0.97);
}

/* Email button */
.auth-options__btn--email {
    background-color: #ffffff;
    color: #1a1a1a;
}

.auth-options__btn--email:hover {
    background-color: #f0f0f0;
}

/* Google button */
.auth-options__btn--google {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-options__btn--google:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

/* Apple button */
.auth-options__btn--apple {
    background-color: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-options__btn--apple:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.auth-options__btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.auth-options__btn-icon svg {
    width: 20px;
    height: 20px;
}

/* Footer link */
.auth-footer {
    text-align: center;
    padding: 16px 0 8px;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
}

.auth-footer__link {
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.auth-footer__link:hover {
    color: var(--color-accent-red, #e53935);
}

/* ============================================
   SCREEN 2: EMAIL LOGIN
   ============================================ */
.auth-email {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 1;
    padding-bottom: 20px;
}

.auth-email__heading {
    font-size: 0.875rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffffff;
    margin-bottom: 20px;
}

.auth-email__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Input fields */
.auth-input-group {
    position: relative;
    width: 100%;
}

.auth-input {
    width: 100%;
    padding: 18px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
}

.auth-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.08);
}

.auth-input--error {
    border-color: #e53935 !important;
}

.auth-input-error-msg {
    font-size: 0.6875rem;
    color: #e53935;
    margin-top: 4px;
    padding-left: 4px;
    display: none;
}

.auth-input-error-msg--visible {
    display: block;
}

/* Password toggle */
.auth-input-group--password .auth-input {
    padding-right: 50px;
}

.auth-password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.2s ease;
}

.auth-password-toggle:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* Submit button */
.auth-submit-btn {
    width: 100%;
    padding: 16px 20px;
    margin-top: 4px;
    border-radius: 14px;
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.auth-submit-btn--active {
    color: #1a1a1a;
    background-color: #ffffff;
    border-color: #ffffff;
}

.auth-submit-btn--active:hover {
    background-color: #f0f0f0;
}

.auth-submit-btn--active:active {
    transform: scale(0.97);
}

.auth-submit-btn:disabled {
    cursor: not-allowed;
}

/* Forgot password */
.auth-forgot {
    text-align: center;
    padding: 16px 0 0;
}

.auth-forgot__link {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-forgot__link:hover {
    color: #ffffff;
}

/* Forgot password description */
.auth-forgot-desc {
    font-size: 0.8125rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ============================================
   SCREEN 3: SOCIAL LOADING
   ============================================ */
.auth-social-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 32px;
    padding-bottom: 80px;
}

.auth-social-loading__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-social-loading__logo svg {
    width: 40px;
    height: 40px;
}

.auth-social-loading__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: authSpin 0.8s linear infinite;
}

.auth-social-loading__text {
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.3px;
}

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

/* ============================================
   SCREEN 4: REGISTER / UPDATE PROFILE
   ============================================ */
.auth-register {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.auth-register__welcome {
    margin-bottom: 24px;
}

.auth-register__welcome-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #ffffff;
    line-height: 1.5;
    margin-bottom: 4px;
}

.auth-register__welcome-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

.auth-register__section-title {
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffffff;
    margin-bottom: 16px;
}

.auth-register__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.auth-register__submit-wrap {
    padding: 20px 0 8px;
    margin-top: auto;
}

/* Select field */
.auth-select-wrapper {
    position: relative;
    width: 100%;
}

.auth-select {
    width: 100%;
    padding: 18px 20px;
    padding-right: 44px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    outline: none;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.auth-select option {
    background-color: #1a1a1a;
    color: #ffffff;
}

.auth-select:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.08);
}

.auth-select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

/* ============================================
   LOGGED IN HEADER STATE
   ============================================ */
.header__user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e53935, #ff6f61);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
}

.header__user-avatar:active {
    transform: scale(0.93);
}

.header__user-avatar:hover {
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.3);
}

/* ============================================
   USER MENU DROPDOWN (when logged in)
   ============================================ */
.auth-user-menu {
    position: fixed;
    top: 56px;
    right: 0;
    z-index: 1001;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    left: 0;
    padding: 0 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.auth-user-menu--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.auth-user-menu__card {
    background: #242424;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.auth-user-menu__info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 12px;
}

.auth-user-menu__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e53935, #ff6f61);
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 800;
    flex-shrink: 0;
}

.auth-user-menu__name {
    font-size: 0.875rem;
    font-weight: 700;
    color: #ffffff;
}

.auth-user-menu__email {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

.auth-user-menu__logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 4px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #e53935;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.auth-user-menu__logout:hover {
    background: rgba(229, 57, 53, 0.08);
}

/* ============================================
   CPF INPUT MASK INDICATOR
   ============================================ */
.auth-input--cpf {
    letter-spacing: 0.5px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-height: 640px) {
    .auth-social-loading {
        padding-bottom: 40px;
    }

    .auth-options {
        padding-bottom: 12px;
    }
}
