/* ===================================================================
   Style Reference Panel - 우측 슬라이드 패널
   PC (769px+): 35% 패널 / 65% 메인
   Tablet (481-768px): 45% 패널 / 55% 메인
   Mobile (≤480px): 100% 패널 (메인 숨김)
   =================================================================== */

/* ===== 패널 오버레이 (모바일 전용) ===== */
.style-ref-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.style-ref-overlay.active {
    display: block;
    opacity: 1;
}

/* ===== 패널 본체 ===== */
.style-ref-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 35%;
    height: 100vh;
    background: linear-gradient(180deg, #1e1a2e 0%, #2a2342 40%, #312450 100%);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.style-ref-panel.active {
    transform: translateX(0);
}

/* 메인 콘텐츠 너비 조정 (패널 활성화 시) */
body.style-ref-open .avatar-container {
    width: 65% !important;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.style-ref-open {
    overflow: hidden;
}

/* ===== 패널 헤더 ===== */
.style-ref-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.style-ref-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.style-ref-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.style-ref-title .ref-icon {
    font-size: 1.2rem;
}

.style-ref-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
}

.style-ref-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.style-ref-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== 현재 선택된 스타일 표시 ===== */
.style-ref-current {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(183, 78, 145, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.style-ref-current-badge {
    padding: 4px 10px;
    background: linear-gradient(135deg, #b74e91, #5e42a6);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.style-ref-current-name {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 필터 탭 ===== */
.style-ref-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 20px 10px;
    flex-shrink: 0;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.style-ref-tabs::-webkit-scrollbar {
    display: none;
}

.style-ref-tab {
    padding: 2px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.style-ref-tab i {
    font-size: 0.7rem;
    opacity: 0.7;
    transition: opacity 0.25s ease;
}

.style-ref-tab:hover {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.15);
}

.style-ref-tab:hover i {
    opacity: 1;
}

.style-ref-tab.active {
    background: linear-gradient(135deg, rgba(183, 78, 145, 0.3), rgba(94, 66, 166, 0.3));
    border-color: rgba(183, 78, 145, 0.4);
    color: #fff;
    font-weight: 600;
}

.style-ref-tab.active i {
    opacity: 1;
}

/* ===== 그리드 컨테이너 ===== */
.style-ref-grid-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 14px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.style-ref-grid-wrapper::-webkit-scrollbar {
    width: 5px;
}

.style-ref-grid-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.style-ref-grid-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.style-ref-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ===== 레퍼런스 카드 ===== */
.style-ref-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    aspect-ratio: 3 / 4;
}

.style-ref-card:hover {
    transform: translateY(-3px);
    border-color: rgba(183, 78, 145, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(183, 78, 145, 0.2);
}

.style-ref-card:active {
    transform: translateY(-1px);
    transition-duration: 0.1s;
}

.style-ref-card.selected {
    border-color: #b74e91;
    box-shadow: 0 0 0 2px rgba(183, 78, 145, 0.5), 0 8px 24px rgba(183, 78, 145, 0.2);
}

.style-ref-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #b74e91;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #fff;
    font-weight: 700;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(183, 78, 145, 0.4);
}

/* 카드 이미지 */
.style-ref-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.style-ref-card:hover .style-ref-card-img {
    transform: scale(1.05);
}

/* 카드 하단 그라디언트 오버레이 */
.style-ref-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 10px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
    z-index: 2;
}

.style-ref-card-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* 인기도 뱃지 */
.style-ref-hot-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background: rgba(255, 87, 51, 0.9);
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    z-index: 3;
    backdrop-filter: blur(4px);
}

.style-ref-hot-badge .hot-emoji {
    font-size: 0.7rem;
}

.style-ref-new-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    background: rgba(76, 175, 80, 0.9);
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    z-index: 3;
    backdrop-filter: blur(4px);
}

/* 이미지 로딩 실패 시 placeholder */
.style-ref-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(94, 66, 166, 0.3), rgba(183, 78, 145, 0.2));
    color: rgba(255, 255, 255, 0.4);
    gap: 8px;
}

.style-ref-card-placeholder i {
    font-size: 2rem;
}

.style-ref-card-placeholder span {
    font-size: 0.7rem;
}

/* ===== 하단 안내 ===== */
.style-ref-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    text-align: center;
}

.style-ref-footer-text {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    line-height: 1.5;
}

.style-ref-footer-text i {
    margin-right: 4px;
    color: rgba(183, 78, 145, 0.6);
}

/* ===== 빈 상태 ===== */
.style-ref-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    gap: 12px;
}

.style-ref-empty i {
    font-size: 2.5rem;
    opacity: 0.5;
}

.style-ref-empty p {
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ===================================================================
   반응형
   =================================================================== */

/* 태블릿 */
@media (min-width: 481px) and (max-width: 768px) {
    .style-ref-panel {
        width: 45%;
    }

    body.style-ref-open .avatar-container {
        width: 55% !important;
    }
}

/* 모바일 */
@media (max-width: 480px) {
    .style-ref-panel {
        width: 100%;
        height: 100dvh;
    }

    body.style-ref-open .avatar-container {
        display: none !important;
    }

    .style-ref-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .style-ref-header {
        padding: 14px 16px 12px;
    }

    .style-ref-tabs {
        padding: 10px 16px 8px;
    }

    .style-ref-grid-wrapper {
        padding: 8px 12px 16px;
    }
}

/* 대형 모니터 */
@media (min-width: 1400px) {
    .style-ref-panel {
        width: 30%;
    }

    body.style-ref-open .avatar-container {
        width: 70% !important;
    }

    .style-ref-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
