/* Beauty Product Gallery Styles */

/* 전역 오버플로우 설정 */
html, body {
    overflow-x: visible;
    padding: 0;
    margin: 0;
}

body {
    min-height: 100vh;
}

/* Tailwind CSS 클래스를 CSS로 변환 */

/* 유틸리티 클래스 */
.w-full { width: 100%; }
.max-w-7xl { max-width: 80rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-6 { padding: 1.5rem; }
.p-4 { padding: 1rem; }
.p-0 { padding: 0; }
.mb-8 { margin-bottom: 2rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-1 { gap: 0.25rem; }

/* 그리드 시스템 - 4열 기본 */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* 그리드 컸테이너 - 확대 여백 확보 */
.beauty-products-grid {
    grid-template-columns: repeat(1, 1fr);
    padding: 2rem 1rem; /* 충분한 여백 추가 */
    gap: 2rem; /* 간격 늘리기 */
}

@media (min-width: 480px) {
    .beauty-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .beauty-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .beauty-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 반응형 그리드 클래스들 */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .xl\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* 텍스트 스타일 */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.leading-tight { line-height: 1.25; }

/* 컬러 */
.text-muted-foreground { color: #717182; }
.bg-white { background-color: #ffffff; }
.bg-muted { background-color: #ececf0; }
.border { border-width: 1px; border-color: rgba(0, 0, 0, 0.1); }

/* 플렉스 */
.flex { display: flex; }
.flex-shrink-0 { flex-shrink: 0; }

/* 포지셔닝 */
.relative { position: relative; }
.absolute { position: absolute; }
.-top-2 { top: -0.5rem; }
.-right-2 { right: -0.5rem; }
.-top-4 { top: -1rem; }
.-left-4 { left: -1rem; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }

/* 크기 */
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-48 { width: 12rem; }
.h-48 { height: 12rem; }
.max-w-32 { max-width: 8rem; }

/* 보더 반경 */
.rounded-lg { border-radius: 0.5rem; }
.rounded-md { border-radius: 0.375rem; }

/* 그림자 */
.shadow-lg { 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); 
}
.shadow-xl { 
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); 
}

/* 오버플로우 */
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 변환 */
.transform { transform: translateX(0) translateY(0) rotate(0) skewX(0) skewY(0) scaleX(1) scaleY(1); }
.-translate-x-full { transform: translateX(-100%); }
.-translate-y-1\/2 { transform: translateY(-50%); }
.scale-105 { transform: scale(1.05); }
.scale-110 { transform: scale(1.1); }

/* 트랜지션 */
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.transition-transform { transition-property: transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.duration-300 { transition-duration: 300ms; }
.duration-200 { transition-duration: 200ms; }

/* 커서 */
.cursor-pointer { cursor: pointer; }

/* 화이트스페이스 */
.whitespace-nowrap { white-space: nowrap; }

/* 투명도 */
.opacity-0 { opacity: 0; }

/* 포인터 이벤트 */
.pointer-events-none { pointer-events: none; }

/* 오브젝트 피트 */
.object-cover { object-fit: cover; }

/* Beauty Gallery 메인 컨테이너 */
.beauty-gallery {
    font-family: 'Zen Kaku Gothic New', sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ffffff;
    min-height: 100vh;
    padding: 2rem; /* 여백 추가 */
    overflow: visible; /* 오버플로우 허용 */
}

.beauty-gallery h1 {
    font-size: 2rem;
    font-weight: 500;
    color: #030213;
    margin-bottom: 1rem;
}

/* 탭 스타일 */
.beauty-tabs {
    margin-bottom: 2rem;
}

.beauty-tabs-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background-color: #ececf0;
    border-radius: 0.5rem;
    padding: 0.25rem;
    gap: 0.25rem;
}

.beauty-tabs-trigger {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #717182;
    background-color: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.beauty-tabs-trigger:hover {
    color: #030213;
    background-color: rgba(255, 255, 255, 0.5);
}

.beauty-tabs-trigger.active {
    color: #030213;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 카드 스타일 - 오버플로우 개선 */
.beauty-card {
    background-color: #ffffff;
    border-radius: 0.625rem;
    overflow: visible; /* hidden에서 visible로 변경 */
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.beauty-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.beauty-card-image {
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 비율 */
    position: relative;
    background-color: #ececf0;
    overflow: hidden; /* 이미지 영역만 overflow: hidden */
    border-radius: 0.625rem 0.625rem 0 0; /* 상단 모서리만 둥글게 */
}

.beauty-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.beauty-card:hover .beauty-card-image img {
    transform: scale(1.05);
}

.beauty-card-content {
    padding: 1rem;
}

.beauty-card-brand {
    font-size: 0.875rem;
    color: #717182;
    margin-bottom: 0.25rem;
}

.beauty-card-title {
    font-size: 1rem;
    font-weight: 500;
    color: #030213;
    line-height: 1.25;
    margin: 0;
}

.beauty-card-price {
    font-size: 0.875rem;
    color: #030213;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* 관련 이미지 오버레이 */
.beauty-related-overlay {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    z-index: 10;
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.beauty-card:hover .beauty-related-overlay {
    opacity: 1;
    pointer-events: auto;
}

.beauty-related-label {
    font-size: 0.75rem;
    color: #717182;
    margin-bottom: 0.5rem;
    white-space: nowrap;
}

.beauty-related-thumbnails {
    display: flex;
    gap: 0.25rem;
}

.beauty-related-info {
    font-size: 0.75rem;
    color: #717182;
    margin-top: 0.25rem;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 관련 이미지 썸네일 개선 - 간단한 호버 확대 */
.beauty-related-thumbnail {
    width: 3rem;
    height: 3rem;
    border-radius: 0.375rem;
    overflow: hidden;
    background-color: #ececf0;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
    touch-action: manipulation; /* 모바일 터치 최적화 */
    transform-origin: center center; /* 중앙 기점 확대 */
}

/* 호버 시 크게 확대되는 효과 - 개선된 버전 */
.beauty-related-thumbnail:hover {
    transform: scale(3.0); /* 2.5에서 3.0으로 증가 */
    z-index: 1000; /* 999에서 1000으로 올리기 */
    border-color: rgba(3, 2, 19, 0.5);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4); /* 그림자 강화 */
    border-radius: 0.5rem;
    position: relative;
    transform-origin: center center; /* 중앙 기준 확대 명시 */
}

.beauty-related-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* 호버 시 이미지도 약간 확대 */
.beauty-related-thumbnail:hover img {
    transform: scale(1.1);
}

/* 호버 시 오버레이 효과 */
.beauty-related-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.beauty-related-thumbnail:hover::before {
    opacity: 1;
}

/* 썸네일 컨테이너에 충분한 공간 확보 */
.beauty-related-thumbnails {
    display: flex;
    gap: 1rem; /* 0.5rem에서 1rem으로 증가 */
    justify-content: center;
    overflow: visible; /* 오버플로우 완전 허용 */
}

/* 관련 이미지 오버레이 개선 - z-index 우선순위 높이기 */
.beauty-related-overlay {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    z-index: 200; /* 50에서 200으로 올리기 */
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    min-width: 200px;
    overflow: visible; /* 오버플로우 허용 */
}

.beauty-card:hover .beauty-related-overlay {
    opacity: 1;
    pointer-events: auto;
}

.beauty-related-label {
    font-size: 0.75rem;
    color: #717182;
    margin-bottom: 0.75rem;
    white-space: nowrap;
    text-align: center;
    font-weight: 500;
}

.beauty-related-info {
    font-size: 0.75rem;
    color: #717182;
    margin-top: 0.75rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 애니메이션 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.beauty-card {
    animation: fadeInUp 0.3s ease-out;
}

.beauty-card:nth-child(2) { animation-delay: 0.1s; }
.beauty-card:nth-child(3) { animation-delay: 0.2s; }
.beauty-card:nth-child(4) { animation-delay: 0.3s; }

/* 로딩 스타일 */
.beauty-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1rem;
    color: #717182;
}

.beauty-loading::after {
    content: "";
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #ececf0;
    border-top: 2px solid #030213;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 반응형 - 모바일/태블릿 호버 최적화 */
@media (max-width: 479px) {
    .beauty-products-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 1rem;
        padding: 1rem 0.5rem; /* 모바일에서 패딩 조정 */
    }
    
    .beauty-gallery {
        padding: 1rem; /* 모바일에서 전체 패딩 줄이기 */
    }
    
    /* 모바일에서 썸네일 호버/터치 효과 */
    .beauty-related-thumbnail {
        width: 2.5rem; /* 3rem에서 2.5rem으로 축소 */
        height: 2.5rem;
    }
    
    .beauty-related-thumbnail:hover {
        transform: scale(2.2); /* 3.0에서 2.2로 조정 */
        z-index: 1001;
    }
    
    .beauty-related-thumbnail:active {
        transform: scale(2.5); /* 터치 시 조금 더 크게 */
        transition: transform 0.15s ease;
    }
    
    .beauty-related-thumbnails {
        padding: 1rem; /* 2rem에서 1rem으로 조정 */
        gap: 0.5rem;
        min-height: 5rem; /* 8rem에서 5rem으로 줄이기 */
    }
    
    .beauty-related-overlay {
        position: static; /* 모바일에서는 고정 위치 */
        opacity: 1;
        margin-top: 0.5rem;
        pointer-events: auto;
        min-width: auto;
        width: 100%;
        z-index: auto;
    }
    
    /* 모바일 탭 및 헤더 조정 */
    .beauty-gallery h1 {
        font-size: 1.5rem; /* 2rem에서 1.5rem으로 */
        margin-bottom: 0.75rem;
    }
    
    .beauty-tabs {
        margin-bottom: 1.5rem; /* 2rem에서 1.5rem으로 */
    }
    
    .beauty-tabs-list {
        grid-template-columns: repeat(2, 1fr); /* 모바일에서 2열 탭 */
        gap: 0.5rem;
        padding: 0.25rem;
    }
    
    .beauty-tabs-trigger {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
        text-align: center;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    /* 작은 태블릿 (가로 480px ~ 767px) */
    .beauty-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem;
        padding: 1.5rem 1rem;
    }
    
    .beauty-gallery {
        padding: 1.5rem;
    }
    
    /* 작은 태블릿에서 썸네일 크기 조정 */
    .beauty-related-thumbnail {
        width: 2.75rem;
        height: 2.75rem;
    }
    
    .beauty-related-thumbnail:hover {
        transform: scale(2.5); /* 작은 태블릿에서 적당한 크기 */
    }
    
    .beauty-related-thumbnail:active {
        transform: scale(2.7);
    }
    
    .beauty-related-thumbnails {
        padding: 1.5rem;
        gap: 0.75rem;
        min-height: 6rem;
    }
    
    /* 작은 태블릿 탭 조정 */
    .beauty-gallery h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .beauty-tabs {
        margin-bottom: 1.75rem;
    }
    
    .beauty-tabs-list {
        grid-template-columns: repeat(4, 1fr); /* 4개 탭 유지 */
        gap: 0.375rem;
    }
    
    .beauty-tabs-trigger {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    /* 큰 태블릿 (가로 768px ~ 1023px) */
    .beauty-products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem;
        padding: 2rem 1.5rem;
    }
    
    .beauty-gallery {
        padding: 2rem 1.5rem;
    }
    
    /* 큰 태블릿에서 썸네일 크기 */
    .beauty-related-thumbnail {
        width: 3rem; /* 기본 크기 유지 */
        height: 3rem;
    }
    
    .beauty-related-thumbnail:hover {
        transform: scale(2.8); /* 태블릿에서 적당한 크기 */
        z-index: 1000;
    }
    
    .beauty-related-thumbnail:active {
        transform: scale(3.0); /* 터치 시 데스크톱과 비슷하게 */
    }
    
    .beauty-related-thumbnails {
        padding: 1.75rem;
        gap: 0.75rem;
        min-height: 7rem;
    }
    
    /* 태블릿에서 탭 조정 */
    .beauty-tabs-list {
        grid-template-columns: repeat(4, 1fr); /* 4개 탭 유지 */
    }
    
    .beauty-tabs-trigger {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
    }
}

@media (min-width: 1024px) {
    /* 데스크톱에서는 4열 */
    .beauty-products-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 2rem; /* 데스크톱에서 충분한 간격 */
        padding: 2rem 1rem;
    }
    
    .beauty-gallery {
        padding: 2rem;
    }
    
    /* 데스크톱에서 최대 확대 효과 */
    .beauty-related-thumbnail {
        width: 3rem;
        height: 3rem;
    }
    
    .beauty-related-thumbnail:hover {
        transform: scale(3.0); /* 데스크톱에서 최대 효과 */
        z-index: 1000;
    }
    
    .beauty-related-thumbnails {
        padding: 2rem; /* 데스크톱에서 충분한 패딩 */
        gap: 1rem;
        min-height: 8rem;
    }
    
    /* 초대형 모니터에서는 더 많은 열 허용 */
    @media (min-width: 1600px) {
        .beauty-products-grid {
            grid-template-columns: repeat(5, 1fr) !important;
            gap: 2.5rem;
            padding: 2.5rem 1.5rem;
        }
        
        .beauty-gallery {
            padding: 2.5rem;
        }
        
        .beauty-related-thumbnails {
            padding: 2.5rem;
            gap: 1.25rem;
            min-height: 9rem;
        }
    }
    
    @media (min-width: 1920px) {
        .beauty-products-grid {
            grid-template-columns: repeat(6, 1fr) !important;
            gap: 3rem;
            padding: 3rem 2rem;
        }
        
        .beauty-gallery {
            padding: 3rem;
        }
        
        .beauty-related-thumbnails {
            padding: 3rem;
            gap: 1.5rem;
            min-height: 10rem;
        }
    }
}

/* 터치 장치 최적화 */
@media (hover: none) and (pointer: coarse) {
    /* 터치 전용 장치 (스마트폰, 태블릿) */
    .beauty-related-thumbnail {
        /* 터치 장치에서는 호버 대신 터치 효과만 */
        transition: transform 0.2s ease;
    }
    
    .beauty-related-thumbnail:hover {
        /* 터치 장치에서 호버 효과 비활성화 */
        transform: none;
    }
    
    .beauty-related-thumbnail:active {
        /* 터치 시만 효과 활성화 */
        transform: scale(2.3);
        transition: transform 0.1s ease;
    }
    
    .beauty-card:hover .beauty-related-overlay {
        /* 터치 장치에서 대체 표시 방식 */
        opacity: 1;
        pointer-events: auto;
    }
}

@media (hover: hover) and (pointer: fine) {
    /* 마우스 장치 (데스크톱, 노트북) */
    .beauty-related-thumbnail:hover {
        /* 마우스 장치에서만 호버 효과 */
        transform: scale(3.0);
    }
    
    .beauty-related-thumbnail:active {
        /* 마우스 클릭 시 약간 축소 */
        transform: scale(2.9);
    }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    .beauty-gallery {
        background-color: #0f0f0f;
        color: #e5e5e5;
    }
    
    .beauty-card {
        background-color: #1a1a1a;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .beauty-related-overlay,
    .beauty-large-preview-content {
        background-color: #1a1a1a;
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .beauty-tabs-list {
        background-color: #2a2a2a;
    }
    
    .beauty-tabs-trigger.active {
        background-color: #1a1a1a;
    }
}