/* ========================================
 * Profile Menu - Button & Dropdown
 * ======================================== */
.profile-menu {
    position: absolute;
    z-index: 200;
}

.profile-menu--portal {
    top: 10px;
    right: 80px;
}

.profile-menu--game {
    top: 8px;
    right: 52px;
}

.profile-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(168, 85, 247, 0.4);
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0;
    overflow: hidden;
}

.profile-btn:hover {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.25);
    transform: scale(1.05);
}

.profile-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.profile-btn-initials {
    font-family: 'Jua', sans-serif;
    font-size: 0.85rem;
    font-weight: bold;
    color: white;
    letter-spacing: 1px;
    line-height: 1;
}

.profile-btn-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ========================================
 * Profile Dropdown Panel
 * ======================================== */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: #1a1a2e;
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(168, 85, 247, 0.05);
    overflow: hidden;
    animation: profileDropIn 0.2s ease;
}

.profile-dropdown.hidden {
    display: none;
}

@keyframes profileDropIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========================================
 * Profile Panels (main / settings / login)
 * ======================================== */
.profile-panel {
    padding: 8px;
}

.profile-panel.hidden {
    display: none;
}

.profile-menu-item {
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    transition: background 0.2s;
    text-align: left;
}

.profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.profile-menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.profile-menu-item .profile-arrow {
    margin-left: auto;
    opacity: 0.4;
    font-size: 0.75rem;
}

/* Back button */
.profile-back-btn {
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    transition: color 0.2s;
}

.profile-back-btn:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Divider */
.profile-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 4px 8px;
}

/* ========================================
 * User Info Row (logged in)
 * ======================================== */
.profile-user-row {
    padding: 12px 14px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-user-email {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.profile-sync-status {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.profile-sync-status svg {
    width: 12px;
    height: 12px;
}

.profile-sync-status.syncing {
    color: #00d4ff;
}

.profile-sync-status.syncing svg {
    animation: syncSpin 1s linear infinite;
}

.profile-sync-status.synced {
    color: #22c55e;
}

.profile-sync-status.error {
    color: #ef4444;
}

/* ========================================
 * Settings - Toggle Switch
 * ======================================== */
.profile-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-radius: 10px;
}

.profile-setting-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.profile-setting-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.profile-setting-label svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.profile-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
    padding: 0;
    flex-shrink: 0;
}

.profile-toggle.active {
    background: rgba(168, 85, 247, 0.5);
}

.profile-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.profile-toggle.active::after {
    transform: translateX(20px);
}

/* Language toggle (text-based) */
.profile-lang-toggle {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 36px;
    text-align: center;
}

.profile-lang-toggle:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
}

/* ========================================
 * Login Panel - Buttons
 * ======================================== */
.profile-login-item {
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.profile-login-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.profile-login-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.profile-login-google {
    background: rgba(255, 255, 255, 0.92);
    color: #3c4043;
    border-color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
}

.profile-login-google:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Warning text */
.profile-warning-text {
    padding: 6px 14px 4px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.72rem;
    color: #ff8c00;
    opacity: 0.7;
}

/* Logout button in dropdown */
.profile-logout-btn {
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    color: #ff6b9d;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    transition: background 0.2s;
    text-align: left;
}

.profile-logout-btn:hover {
    background: rgba(255, 107, 157, 0.08);
}

.profile-logout-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ========================================
 * Auth Modal Overlay
 * ======================================== */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: authFadeIn 0.3s ease;
}

.auth-modal-overlay.hidden {
    display: none;
}

@keyframes authFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-modal-content {
    background: #1a1a2e;
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(168, 85, 247, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(168, 85, 247, 0.05);
    animation: authSlideUp 0.3s ease;
    position: relative;
}

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

.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.auth-modal-close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.auth-modal-title {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #a855f7, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
}

/* Form inputs */
.auth-form-group {
    margin-bottom: 16px;
    text-align: left;
}

.auth-form-group.hidden {
    display: none;
}

.auth-form-label {
    display: block;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 6px;
}

.auth-form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: white;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s, background 0.3s;
    box-sizing: border-box;
}

.auth-form-input:focus {
    border-color: #a855f7;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.auth-form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Submit button */
.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    border: none;
    border-radius: 14px;
    color: white;
    font-family: 'Jua', sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

.auth-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Toggle link */
.auth-switch-btn {
    background: none;
    border: none;
    color: #00d4ff;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 16px;
    padding: 4px 8px;
    transition: color 0.3s;
    display: inline-block;
}

.auth-switch-btn:hover {
    color: #38bdf8;
    text-decoration: underline;
}

/* Error/success messages */
.auth-error-msg {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: 'Noto Sans KR', sans-serif;
    margin-bottom: 12px;
    display: none;
    text-align: left;
}

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

.auth-success-msg {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: 'Noto Sans KR', sans-serif;
    margin-bottom: 12px;
    display: none;
    text-align: left;
}

.auth-success-msg.visible {
    display: block;
}

/* ========================================
 * Cloud Save - Sync Banner (Signup Modal)
 * ======================================== */
.auth-sync-banner {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    color: #00d4ff;
}

.auth-sync-banner-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* ========================================
 * OAuth - Divider & Google Button (Modal)
 * ======================================== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
}

.auth-google-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    color: #3c4043;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-google-btn:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.auth-google-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

@keyframes syncSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
 * Mobile responsive
 * ======================================== */
@media (max-width: 768px) {
    .auth-modal-content {
        width: 95%;
        padding: 24px 20px;
    }

    .profile-menu--portal {
        top: 8px;
        right: 60px;
    }

    .profile-btn {
        width: 36px;
        height: 36px;
    }

    .profile-btn svg {
        width: 18px;
        height: 18px;
    }

    .profile-btn-initials {
        font-size: 0.75rem;
    }

    .profile-dropdown {
        width: 220px;
    }
}

@media (max-width: 480px) {
    .profile-menu--portal {
        right: 50px;
    }
}
