/* Auth UI - Sign In button, modal panel, profile chrome, guest-merge prompt */

/* ---- Menu sign-in button ---- */
.app-menu-item.auth-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: flex-start;
    text-align: left;
}

.auth-menu-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.85rem;
}

.auth-menu-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.auth-menu-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-menu-item.auth-menu-item.has-session {
    border-color: var(--secondary);
}

/* ---- Overlay + Modal panel ---- */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1500;
}

.auth-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.auth-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 16px));
    width: min(420px, 92vw);
    background: linear-gradient(160deg, rgba(0, 0, 0, 0.96), rgba(15, 15, 22, 0.96));
    border: 1px solid var(--primary);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px var(--glow-color-40);
    color: var(--text);
    z-index: 1600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    overflow: hidden;
}

.auth-panel.open {
    opacity: 1;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.auth-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--primary);
}

.auth-panel-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.auth-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--primary);
    background: rgba(0, 0, 0, 0.6);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.auth-close:hover,
.auth-close:focus-visible {
    background: var(--primary);
    color: var(--background);
    outline: none;
    transform: rotate(90deg);
}

.auth-panel-body {
    padding: 1.1rem 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.auth-panel-subtitle {
    margin: 0 0 0.25rem;
    color: var(--text);
    opacity: 0.7;
    font-size: 0.88rem;
    line-height: 1.45;
}

/* ---- Provider buttons ---- */
.auth-provider-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.auth-provider {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.18s ease, border-color 0.18s ease,
                color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}

.auth-provider:hover,
.auth-provider:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--secondary);
    transform: translateY(-1px);
    box-shadow: 0 0 18px var(--glow-color-40);
    outline: none;
}

.auth-provider:disabled,
.auth-provider.loading {
    opacity: 0.6;
    cursor: progress;
}

.auth-provider-icon {
    width: 22px;
    text-align: center;
    font-size: 1.05rem;
    flex: 0 0 auto;
}

.auth-provider-google .auth-provider-icon { color: #4285F4; }
.auth-provider-facebook .auth-provider-icon { color: #1877F2; }
.auth-provider-guest .auth-provider-icon { color: var(--primary); }

.auth-provider-label {
    flex: 1 1 auto;
}

.auth-provider-tag {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--primary);
    text-transform: uppercase;
}

/* ---- Signed-in profile view inside the modal ---- */
.auth-signed-in {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.auth-profile {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 0.95rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--primary);
    border-radius: 8px;
}

.auth-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.07);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
    border: 1px solid var(--primary);
}

.auth-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.auth-profile-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.auth-profile-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-profile-provider {
    font-size: 0.78rem;
    color: var(--text);
    opacity: 0.6;
    margin-top: 0.15rem;
}

/* ---- Buttons ---- */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.auth-btn:hover,
.auth-btn:focus-visible {
    background: var(--primary);
    color: var(--background);
    transform: translateY(-1px);
    outline: none;
}

.auth-btn-primary {
    border-color: var(--secondary);
    background: var(--primary);
    color: var(--background);
}

.auth-btn-primary:hover,
.auth-btn-primary:focus-visible {
    background: var(--secondary);
}

.auth-btn-secondary {
    background: rgba(255, 255, 255, 0.04);
}

/* ---- Error toast inside modal ---- */
.auth-error {
    margin: 0 1.1rem 1.1rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid #b94747;
    background: rgba(185, 71, 71, 0.12);
    color: #ffbcbc;
    font-size: 0.85rem;
    border-radius: 6px;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.auth-error.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Guest-merge confirm overlay ---- */
.auth-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1700;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.auth-confirm {
    width: min(440px, 92vw);
    background: linear-gradient(160deg, rgba(0, 0, 0, 0.97), rgba(15, 15, 22, 0.97));
    border: 1px solid var(--primary);
    border-radius: 10px;
    padding: 1.25rem 1.25rem 1.1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px var(--glow-color-40);
    color: var(--text);
}

.auth-confirm h3 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.auth-confirm p {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.85;
}

.auth-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ---- Mobile tuning ---- */
@media (max-width: 600px) {
    .auth-panel {
        width: 96vw;
    }
    .auth-provider {
        padding: 0.85rem 0.95rem;
    }
}
