/* Anime Wordle - Auth widget + delete modal styles
 * Loaded by all game pages via <link rel="stylesheet" href="shared/auth.css">.
 * Uses CSS variables defined in shared/styles.css (--accent-sky, --accent-ocean,
 * --text-primary, --text-secondary).
 */

/* --- Trigger button (logged-out & logged-in share base) ----------------- */
.aw-profile-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary, #F5F5F0);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 0;
    overflow: hidden;
    transition: background 0.2s, border-color 0.2s;
}
.aw-profile-btn:hover { background: rgba(91, 164, 212, 0.3); border-color: var(--accent-sky, #5BA4D4); }
.aw-profile-btn img { width: 100%; height: 100%; object-fit: cover; }

/* --- Dropdown panel ------------------------------------------------------ */
.aw-profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: rgba(20, 60, 100, 0.97);
    border: 1px solid rgba(91, 164, 212, 0.3);
    border-radius: 12px;
    padding: 16px;
    color: var(--text-primary, #F5F5F0);
    font-family: 'Segoe UI', Tahoma, sans-serif;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 1000;
}
.aw-profile-slot { position: relative; display: inline-block; }

.aw-dropdown-title    { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.aw-dropdown-subtitle { font-size: 0.82rem; color: rgba(245,245,240,0.65); margin-bottom: 14px; }

/* --- Provider buttons (Google + Apple) --------------------------------- */
.aw-provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: filter 0.2s;
}
.aw-provider-btn:last-child { margin-bottom: 0; }
.aw-provider-btn:hover { filter: brightness(1.1); }
.aw-provider-btn:disabled { opacity: 0.6; cursor: wait; }

.aw-provider-google { background: #FFFFFF; color: #1F1F1F; border-color: #DADCE0; }
.aw-provider-apple  { background: #000000; color: #FFFFFF; border-color: #000000; }
.aw-provider-icon   { width: 18px; height: 18px; flex-shrink: 0; }

/* --- Logged-in section -------------------------------------------------- */
.aw-user-email {
    font-size: 0.78rem;
    color: rgba(245, 245, 240, 0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 6px;
}

/* --- Handle (gamertag) row --------------------------------------------- */
.aw-handle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.aw-handle-display {
    min-width: 0;
    flex: 1;
}
.aw-handle-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(245, 245, 240, 0.55);
    margin-bottom: 2px;
}
.aw-handle-text {
    font-weight: 600;
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary, #F5F5F0);
}
.aw-handle-edit-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid rgba(91, 164, 212, 0.3);
    border-radius: 8px;
    color: var(--text-primary, #F5F5F0);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}
.aw-handle-edit-btn:hover { background: rgba(91, 164, 212, 0.15); border-color: rgba(91, 164, 212, 0.55); }
.aw-handle-edit-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Handle edit form -------------------------------------------------- */
.aw-handle-edit { display: block; }
.aw-handle-edit .aw-handle-label { margin-bottom: 6px; }
.aw-handle-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(91, 164, 212, 0.4);
    border-radius: 8px;
    padding: 4px 10px;
    transition: border-color 0.15s;
}
.aw-handle-input-row:focus-within {
    border-color: var(--accent-sky, #5BA4D4);
}
.aw-handle-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #F5F5F0);
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 6px 0;
}
.aw-handle-input::placeholder { color: rgba(245, 245, 240, 0.4); }
.aw-handle-discriminator {
    color: rgba(245, 245, 240, 0.55);
    font-weight: 500;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.aw-handle-hint {
    font-size: 0.75rem;
    color: rgba(245, 245, 240, 0.55);
    margin-top: 6px;
    line-height: 1.3;
}
.aw-handle-error {
    font-size: 0.78rem;
    color: #FFB6B6;
    margin-top: 6px;
    line-height: 1.3;
}
.aw-handle-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}
.aw-handle-actions .aw-btn-secondary,
.aw-handle-actions .aw-btn-primary {
    padding: 7px 14px;
    font-size: 0.85rem;
}
.aw-btn-primary {
    background: var(--accent-sky, #5BA4D4);
    border: 1px solid var(--accent-sky, #5BA4D4);
    color: #0B2540;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.aw-btn-primary:hover { background: #6FB6E0; }
.aw-btn-primary:disabled { opacity: 0.6; cursor: wait; }

.aw-divider { border-top: 1px solid rgba(91,164,212,0.2); margin: 10px 0; }

.aw-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    color: var(--text-primary, #F5F5F0);
    font-size: 0.9rem;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.aw-action-btn:hover { background: rgba(91,164,212,0.18); }
.aw-action-btn.aw-danger { color: #FF6B6B; }
.aw-action-btn.aw-danger:hover { background: rgba(255,138,138,0.12); }

/* --- Inline error in dropdown ------------------------------------------ */
.aw-inline-error {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(255,138,138,0.12);
    border: 1px solid rgba(255,138,138,0.35);
    border-radius: 6px;
    font-size: 0.82rem;
    color: #FFB6B6;
}

/* --- Focus rings (a11y) ----------------------------------------------- */
.aw-profile-btn:focus-visible,
.aw-provider-btn:focus-visible,
.aw-action-btn:focus-visible,
.aw-btn-secondary:focus-visible,
.aw-btn-danger:focus-visible,
.aw-btn-primary:focus-visible,
.aw-handle-edit-btn:focus-visible {
    outline: 2px solid var(--accent-sky, #5BA4D4);
    outline-offset: 2px;
}

/* --- Delete confirmation modal ----------------------------------------- */
.aw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2600;
    padding: 20px;
}
.aw-modal-overlay.aw-open { display: flex; }
.aw-modal {
    background: rgba(20,60,100,0.98);
    border: 1px solid rgba(91,164,212,0.3);
    border-radius: 14px;
    padding: 24px;
    max-width: 420px;
    width: 100%;
    color: var(--text-primary, #F5F5F0);
    font-family: 'Segoe UI', Tahoma, sans-serif;
}
.aw-modal-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; }
.aw-modal-body  { font-size: 0.92rem; line-height: 1.5; color: rgba(245,245,240,0.85); margin-bottom: 18px; }
.aw-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.aw-btn-secondary {
    padding: 9px 16px;
    background: transparent;
    border: 1px solid rgba(91,164,212,0.4);
    color: var(--text-primary, #F5F5F0);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}
.aw-btn-secondary:hover { background: rgba(91,164,212,0.15); }
.aw-btn-danger {
    padding: 9px 16px;
    background: #C8453B;
    border: 1px solid #C8453B;
    color: #FFFFFF;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}
.aw-btn-danger:hover { background: #B0392F; }
.aw-btn-danger:disabled { opacity: 0.6; cursor: wait; }
.aw-modal-error { color: #FFB6B6; font-size: 0.85rem; margin-top: 12px; }

/* --- Toast (deletion success) ----------------------------------------- */
.aw-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20,60,100,0.97);
    border: 1px solid rgba(91,164,212,0.4);
    color: var(--text-primary, #F5F5F0);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    z-index: 3100;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.aw-toast.aw-toast-show { opacity: 1; }

/* --- Mobile sheet ----------------------------------------------------- */
@media (max-width: 600px) {
    .aw-profile-dropdown {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 85vw;
        max-width: 320px;
        border-radius: 0;
        border-top: none;
        border-right: none;
        border-bottom: none;
        transform: translateX(100%);
        animation: aw-slide-in 0.2s ease-out forwards;
    }
    @keyframes aw-slide-in {
        from { transform: translateX(100%); }
        to   { transform: translateX(0); }
    }
}
