/* Header */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 20px 15px;
    border-bottom: none;
    background-color: var(--main-purple);
    /* 항상 화면 상단 고정, #app 폭에 맞춰 중앙 정렬 */
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, 0);
    width: 100%;
    max-width: 768px;
    z-index: 1000;
    transition: transform 0.22s ease;
    will-change: transform;
}

/* Hide-on-scroll state */
.header.header-hidden {
    transform: translate(-50%, -110%);
}

.header-menu {
    font-size: 1.2rem;
    color: #fff;
    cursor: pointer;
    justify-self: start;
    position: relative; /* 상대 위치 설정 */
}

.header-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: inherit;
}

/* 히트박스 확장을 위한 의사 요소 */
.header-menu::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px; /* 원하는 히트박스 크기 */
    height: 48px;
    /* border-radius: 50%; */ /* 동그라미 형태 제거 */
    z-index: -1; /* 아이콘 뒤로 보내기 */
}

.header-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    text-align: center;
}

.header-title span {
    font-weight: normal;
    color: rgba(255, 255, 255, 0.85);
}

.header-refresh i {
    font-size: 1.2rem;
    color: #fff;
}

.header-refresh { cursor: default; display: inline-flex; align-items: center; gap: 12px; justify-self: end; }
.header-refresh .btn-refresh { cursor: pointer; }
.header-refresh .theme-toggle {
    cursor: pointer;
    background: none;
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 더보기 메뉴 */
.header-more-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-more {
    cursor: pointer;
    background: none;
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.btn-more:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-more:active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 드롭다운 메뉴 */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    /* Liquid Glass (light): translucent gradient + blur + subtle inner highlight */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.36));
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 14px;
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    box-shadow:
      0 8px 26px rgba(0, 0, 0, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.45);
    background-clip: padding-box;
    min-width: 200px;
    z-index: 1001;
    padding: 8px 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, backdrop-filter 0.2s ease;
    pointer-events: none;
}

/* Highlight ring */
.dropdown-menu::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px; /* ring thickness */
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.dropdown-menu.show {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-align: left;
}

.dropdown-item:hover {
    background-color: var(--purple-hover);
}

.dropdown-item:active {
    background-color: rgba(133, 114, 238, 0.15);
}

.dropdown-item i {
    width: 20px;
    font-size: 14px;
    color: var(--text-gray);
    text-align: center;
}

.dropdown-item span {
    flex: 1;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-gray);
    margin: 8px 0;
}

/* 다크모드 대응 */
body.dark-mode .dropdown-menu {
    /* Liquid Glass (dark) */
    background: linear-gradient(135deg, rgba(34, 35, 40, 0.68), rgba(20, 21, 25, 0.46));
    border: 1px solid rgba(255, 255, 255, 0.16);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    box-shadow:
      0 10px 28px rgba(0, 0, 0, 0.62),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.dark-mode .dropdown-menu::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.05));
}

body.dark-mode .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .dropdown-item:active {
    background-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .dropdown-divider {
    background-color: rgba(255, 255, 255, 0.1);
}

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

.header-refresh i.spin { animation: spin360 0.8s linear 1; }
