/* ==========================================================================
   AUTH UI — Authentication Elements
   Makeup Artist Pro · Editorial Luxury Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. AUTH ICON (Logged-out state — nav bar login button)
   -------------------------------------------------------------------------- */
.auth-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--color-text);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.auth-icon:hover {
    color: var(--color-black);
}

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


/* --------------------------------------------------------------------------
   2. AUTH WRAPPER (Container for avatar + dropdown)
   -------------------------------------------------------------------------- */
.auth-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}


/* --------------------------------------------------------------------------
   3. AUTH AVATAR (Logged-in state — button wrapping the circular profile image)
   -------------------------------------------------------------------------- */
.auth-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.auth-avatar__img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--color-mid-gray);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
    display: block;
}

.auth-avatar:hover .auth-avatar__img {
    border-color: var(--color-gold);
    box-shadow: 0 0 0 2px rgba(137, 8, 8, 0.12);
    transform: scale(1.05);
}

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


/* --------------------------------------------------------------------------
   4. AUTH DROPDOWN (Profile menu)
   -------------------------------------------------------------------------- */
.auth-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 240px;
    background: var(--color-white);
    border: 1px solid rgba(85, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow:
        0 8px 32px rgba(85, 0, 0, 0.1),
        0 2px 8px rgba(85, 0, 0, 0.04);
    padding: var(--spacing-sm) 0;
    z-index: 1000;

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition:
        opacity 0.25s cubic-bezier(0.25, 0.1, 0.25, 1),
        visibility 0.25s cubic-bezier(0.25, 0.1, 0.25, 1),
        transform 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
    pointer-events: none;
}

/* Arrow / caret pointing up toward avatar */
.auth-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 14px;
    width: 12px;
    height: 12px;
    background: var(--color-white);
    border-top: 1px solid rgba(85, 0, 0, 0.08);
    border-left: 1px solid rgba(85, 0, 0, 0.08);
    transform: rotate(45deg);
    z-index: 1;
}

/* Active / visible state */
.auth-dropdown--active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}


/* --------------------------------------------------------------------------
   5. AUTH DROPDOWN HEADER (User info section)
   -------------------------------------------------------------------------- */
.auth-dropdown__header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
}

.auth-dropdown__header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--color-mid-gray);
    flex-shrink: 0;
}

.auth-dropdown__header-info {
    display: flex;
    flex-direction: column;
    min-width: 0; /* allow text truncation */
}

.auth-dropdown__name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-dropdown__email {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--color-text-light);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* --------------------------------------------------------------------------
   6. AUTH DROPDOWN DIVIDER
   -------------------------------------------------------------------------- */
.auth-dropdown__divider {
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(85, 0, 0, 0.08) 20%,
        rgba(85, 0, 0, 0.08) 80%,
        transparent
    );
    margin: var(--spacing-xs) 0;
}


/* --------------------------------------------------------------------------
   7. AUTH DROPDOWN LINKS (Menu items)
   -------------------------------------------------------------------------- */
.auth-dropdown__link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.auth-dropdown__link:hover {
    color: var(--color-gold);
    background-color: rgba(137, 8, 8, 0.03);
}

.auth-dropdown__link svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.5;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.auth-dropdown__link:hover svg {
    opacity: 1;
}

/* Sign-out link — slightly distinct */
.auth-dropdown__link--signout {
    color: var(--color-text-light);
}

.auth-dropdown__link--signout:hover {
    color: var(--color-gold);
}


/* --------------------------------------------------------------------------
   8. AUTH ADMIN BADGE
   -------------------------------------------------------------------------- */
.auth-admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-gold);
    background: rgba(137, 8, 8, 0.06);
    padding: 1px 6px;
    border-radius: 3px;
    line-height: 1.6;
    margin-left: var(--spacing-xs);
    vertical-align: middle;
}

/* Tiny gold dot variant */
.auth-admin-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-gold);
    flex-shrink: 0;
}


/* --------------------------------------------------------------------------
   9. AUTH MOBILE LINK (Login/logout in mobile menu)
   -------------------------------------------------------------------------- */
.auth-mobile-link {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 400;
    color: var(--color-text);
    padding: var(--spacing-sm) 0;
    text-decoration: none;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.4s ease, transform 0.4s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.mobile-menu.is-open .auth-mobile-link {
    opacity: 1;
    transform: translateY(0);
}

.auth-mobile-link:hover {
    color: var(--color-gold);
}

/* Login variant — subtle icon accent */
.auth-mobile-link--login::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-gold);
    margin-right: var(--spacing-xs);
    vertical-align: middle;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.auth-mobile-link--login:hover::before {
    opacity: 1;
}

/* Mobile user info (shown when logged in) */
.auth-mobile-link--user {
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--color-text-light);
}

.auth-mobile-link--user:hover {
    color: var(--color-gold);
}

.auth-mobile-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--color-mid-gray);
    vertical-align: middle;
}


/* --------------------------------------------------------------------------
   10. RESPONSIVE — Tablet & Mobile
   -------------------------------------------------------------------------- */

/* Tablet (< 768px) */
@media (max-width: 768px) {
    .auth-avatar {
        width: 26px;
        height: 26px;
    }

    .auth-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        border-radius: 16px 16px 0 0;
        padding: var(--spacing-md) 0 var(--spacing-lg);
        box-shadow: 0 -8px 40px rgba(85, 0, 0, 0.12);
        transform: translateY(100%);
    }

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

    /* Hide the arrow on mobile bottom-sheet style */
    .auth-dropdown::before {
        display: none;
    }

    /* Larger touch targets on mobile */
    .auth-dropdown__link {
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 0.95rem;
    }

    .auth-dropdown__header {
        padding: var(--spacing-md) var(--spacing-lg) var(--spacing-md);
    }

    .auth-dropdown__header-avatar {
        width: 44px;
        height: 44px;
    }

    .auth-dropdown__name {
        font-size: 1rem;
    }

    .auth-dropdown__email {
        font-size: 0.8rem;
    }
}

/* Small phones (< 480px) */
@media (max-width: 480px) {
    .auth-icon {
        width: 36px;
        height: 36px;
    }

    .auth-avatar {
        width: 24px;
        height: 24px;
    }

    .auth-dropdown__link {
        padding: var(--spacing-md) var(--spacing-md);
    }
}


/* --------------------------------------------------------------------------
   11. BACKDROP OVERLAY (for mobile dropdown)
   -------------------------------------------------------------------------- */
.auth-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(85, 0, 0, 0.15);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-backdrop--active {
    opacity: 1;
    visibility: visible;
}
