/* =========================================================
   AABW 공통 왼쪽 플로팅 프로필 메뉴
   - 로그인 사용자용 좌측 메뉴 컴포넌트입니다.
   - HTML은 common/floating-profile.php에서 관리합니다.
========================================================= */

:root {
    --floating-profile-left: 130px;
    --floating-profile-top: 56%;
    --floating-profile-width: 292px;
    --floating-profile-radius: 25px;
    --floating-profile-panel-padding: 25px;
    --floating-profile-z-index: 950;

    --floating-profile-white-05: rgba(255, 255, 255, 0.05);
    --floating-profile-white-06: rgba(255, 255, 255, 0.06);
    --floating-profile-white-07: rgba(255, 255, 255, 0.07);
    --floating-profile-white-08: rgba(255, 255, 255, 0.08);
    --floating-profile-white-12: rgba(255, 255, 255, 0.12);
    --floating-profile-white-14: rgba(255, 255, 255, 0.14);
    --floating-profile-white-16: rgba(255, 255, 255, 0.16);
    --floating-profile-white-18: rgba(255, 255, 255, 0.18);
    --floating-profile-white-24: rgba(255, 255, 255, 0.24);
}

/* ==========================================================================
   Base Layout
========================================================================== */

.floating-profile {
    position: fixed;
    top: var(--floating-profile-top);
    left: var(--floating-profile-left);
    z-index: var(--floating-profile-z-index);
    width: var(--floating-profile-width);
    opacity: 0;
    transform: translateY(-50%);
}

body.motion-ready .floating-profile {
    animation: revealFloatingProfile 0.95s cubic-bezier(0.22, 1, 0.36, 1) 0.14s forwards;
}

@keyframes revealFloatingProfile {
    0% {
        opacity: 0;
        transform: translateY(-50%) translateX(-18px) scale(0.985);
        filter: blur(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(-50%) translateX(0) scale(1);
        filter: blur(0);
    }
}

/* ==========================================================================
   Panel
========================================================================== */

.floating-profile__panel {
    position: relative;
    overflow: hidden;
    padding: var(--floating-profile-panel-padding);
    border: 1px solid var(--floating-profile-white-14);
    border-radius: var(--floating-profile-radius);
    background: linear-gradient(
        180deg,
        var(--floating-profile-white-16),
        var(--floating-profile-white-07)
    );
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.floating-profile__panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        var(--floating-profile-white-18),
        transparent 30%,
        transparent 70%,
        var(--floating-profile-white-06)
    );
}

.floating-profile__name,
.floating-profile__email,
.floating-profile__meta,
.floating-profile__nav {
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Profile Text
========================================================================== */

.floating-profile__name {
    margin-bottom: 6px;
    font-size: 26px;
    font-weight: 800;
}

.floating-profile__email,
.floating-profile__meta {
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    line-height: 1.7;
    word-break: break-all;
}

.floating-profile__meta {
    margin-top: 20px;
}

/* ==========================================================================
   Navigation
========================================================================== */

.floating-profile__nav,
.floating-profile__group {
    display: flex;
    flex-direction: column;
}

.floating-profile__nav {
    gap: 16px;
    margin-top: 22px;
}

.floating-profile__group {
    gap: 10px;
}

.floating-profile__group + .floating-profile__group {
    padding-top: 16px;
    border-top: 1px solid var(--floating-profile-white-12);
}

.floating-profile__group-title {
    padding: 0 4px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.floating-profile__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 15px;
    border: 1px solid var(--floating-profile-white-08);
    border-radius: 14px;
    color: #fff;
    text-decoration: none;
    background: var(--floating-profile-white-05);
    transition:
        transform 0.25s ease,
        background 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.floating-profile__link:hover,
.floating-profile__link.is-current:hover {
    color: #fff;
    background: var(--floating-profile-white-12);
    transform: translateX(4px);
}

.floating-profile__link.is-current {
    background: var(--floating-profile-white-18);
    border-color: var(--floating-profile-white-24);
    box-shadow: inset 0 1px 0 var(--floating-profile-white-12);
}

.floating-profile__link--logout {
    color: #ffd7d7;
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.18);
}

.floating-profile__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 24px;
    padding: 0 10px;
    border: 1px solid var(--floating-profile-white-16);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 11px;
    font-weight: 800;
    background: var(--floating-profile-white-16);
}

/* ==========================================================================
   Responsive
========================================================================== */

/* 데스크톱: 화면이 줄어들면 플로팅 메뉴도 자연스럽게 왼쪽으로 이동 */
@media (min-width: 1201px) {
    html,
    body,
    body.has-floating-profile {
        min-width: 1180px;
        overflow-x: auto;
    }

    .floating-profile {
        left: clamp(24px, calc((100vw - 1000px) / 20 + 60px), 130px);
    }
}

/* 넓은 데스크톱: 1750px부터 1500px까지 화면이 줄어들수록 왼쪽으로 이동 */
@media (min-width: 1501px) and (max-width: 1750px) {
    .floating-profile {
        left: clamp(40px, calc((100vw - 1500px) * 0.15 + 40px), 130px);
    }
}

/* 중간 데스크톱: 화면이 줄어들수록 왼쪽으로 이동하고 폭만 자연스럽게 축소 */
@media (min-width: 1201px) and (max-width: 1500px) {
    .floating-profile {
        left: clamp(8px, calc((100vw - 1200px) * 0.25), 40px);
        width: clamp(210px, calc((100vw - 1200px) * 0.12 + 210px), 260px);
    }

    .floating-profile__panel {
        padding: clamp(18px, 1.6vw, 22px);
    }
}

/* 1200px 이하: 좌측 고정 메뉴를 일반 블록처럼 배치 */
@media (max-width: 1200px) {
    html,
    body,
    body.has-floating-profile {
        min-width: 0;
        overflow-x: hidden;
    }

    .floating-profile {
        position: relative;
        top: auto;
        left: auto;
        width: auto;
        margin: 100px 22px 24px;
        opacity: 1;
        transform: none;
    }

    body.motion-ready .floating-profile {
        animation: none;
    }
}

/* 사용자가 모션 감소 옵션을 켠 경우 */
@media (prefers-reduced-motion: reduce) {
    .floating-profile,
    body.motion-ready .floating-profile {
        opacity: 1 !important;
        transform: translateY(-50%) !important;
        filter: none !important;
        animation: none !important;
    }

    @media (max-width: 1200px) {
        .floating-profile,
        body.motion-ready .floating-profile {
            transform: none !important;
        }
    }
}
