/* ============================================
   가로 스크롤 가이드 스타일 (책 넘기기 효과)
   - SEO 최적화: 모든 콘텐츠가 DOM에 존재
   - PC/모바일 반응형 지원
   ============================================ */

/* 가이드 섹션 레이아웃 안정화 */
.guide-item {
    max-width: 100%;
    overflow: hidden; /* 내부 콘텐츠가 밖으로 넘치지 않도록 */
    box-sizing: border-box;
    min-width: 0; /* Flexbox 자식 요소가 부모를 넘지 않도록 */
}

/* PC에서 우측 섹션이 확장되지 않도록 (Flexbox shrink 문제 해결) */
.order-content-secondary {
    min-width: 0 !important; /* Flexbox에서 shrink 허용 */
    overflow: hidden !important;
    max-width: 100% !important;
}

/* 스크롤 컨테이너가 부모 너비를 넘지 않도록 */
.scroll-wrapper {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.horizontal-scroll-container {
    max-width: 100% !important;
}

.guide-scroll-section {
    width: 100%;
    position: relative;
    padding: 10px 0;
}

/* 가로 스크롤 래퍼 (화살표 배치용) */
.scroll-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding: 0 30px; /* 화살표 공간 확보 */
    box-sizing: border-box;
}

.horizontal-scroll-container {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 10px 4px 30px 4px; /* 하단 여백 확보 */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    width: 100%;
}

/* 스크롤바 커스텀 */
.horizontal-scroll-container::-webkit-scrollbar {
    height: 6px;
}
.horizontal-scroll-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}
.horizontal-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.horizontal-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 좌우 화살표 버튼 */
.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    transition: all 0.2s;
}

.scroll-arrow:hover {
    background: #f8f9fa;
    color: #005ff0;
}

.scroll-arrow.prev { left: 0; }
.scroll-arrow.next { right: 0; }

/* 모바일에서는 화살표 숨김 (터치 스크롤이 더 편함) */
@media screen and (max-width: 768px) {
    .scroll-arrow { display: none; }
    
    .scroll-wrapper {
        padding: 0; /* 모바일에서는 화살표 공간 불필요 */
    }
}

/* 가이드 카드 스타일 */
.guide-card {
    flex: 0 0 260px; /* PC 기본 너비 */
    min-width: 260px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    scroll-snap-align: start;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.guide-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
    z-index: 1;
}

/* 이미지 스타일은 아래 figure 기반으로 이동 */

.guide-card h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 12px 0 8px;
    color: #1e293b;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.guide-card p {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 16px;
    word-break: keep-all;
}

/* 뱃지 스타일 */
.card-header-badge {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-header-badge.step { background: #eff6ff; color: #3b82f6; }
.card-header-badge.insta { background: #fdf2f8; color: #db2777; }
.card-header-badge.youtube { background: #fef2f2; color: #dc2626; }
.card-header-badge.facebook { background: #eff6ff; color: #1877f2; }
.card-header-badge.warning { background: #fef3c7; color: #d97706; }

/* 가이드 탭 컨테이너 */
.guide-tabs-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.guide-tabs-container::-webkit-scrollbar {
    display: none;
}

.guide-tabs {
    display: flex;
    gap: 8px;
    padding: 0 4px;
}

.guide-tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guide-tab-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.guide-tab-btn:hover {
    background: #e9ecef;
}

.guide-tab-btn.active {
    background: #185bdc;
    color: #ffffff;
    border-color: #185bdc;
    box-shadow: 0 2px 6px rgba(24, 91, 220, 0.2);
}

.text-primary {
    color: #185bdc !important;
    font-weight: 700;
}

/* 이미지 확대 라이트박스 */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
    cursor: zoom-out;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
    animation: zoomIn 0.2s ease;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 가이드 카드 이미지 컨테이너 */
.guide-card figure {
    position: relative;
    margin: 0;
    margin-top: auto;
    width: 100%;
    height: 160px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 가이드 카드 이미지 호버 효과 */
.guide-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.guide-card figure:hover img {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 확대 아이콘 오버레이 */
.guide-card .zoom-hint {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 1;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 호버 시 클릭 유도 애니메이션 */
.guide-card figure:hover .zoom-hint {
    background: rgba(24, 91, 220, 0.9);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(24, 91, 220, 0.4);
    animation: pulse-zoom 1.5s ease-in-out infinite;
}

@keyframes pulse-zoom {
    0%, 100% {
        transform: scale(1.15);
    }
    50% {
        transform: scale(1.25);
    }
}

/* 이미지 없는 카드 (주의사항 등) - 텍스트 중심 레이아웃 */
.guide-card.no-image {
    justify-content: flex-start;
}

.guide-card.no-image p {
    margin-bottom: 0;
    flex-grow: 1;
}

/* 가이드 버튼 래퍼 (화살표 포함) */
.guide-tabs-wrapper {
    position: relative;
    padding: 0 36px;
}

/* 탭 화살표 버튼 */
.tabs-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    z-index: 10;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.tabs-arrow:hover {
    background: #f8f9fa;
    color: #185bdc;
    border-color: #185bdc;
}

.tabs-arrow.prev { left: 0; }
.tabs-arrow.next { right: 0; }

/* 가이드 버튼 그리드 (페이지 넘기기 방식) */
.guide-tabs-grid {
    display: grid;
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 20px) / 3);
    gap: 10px;
    padding: 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none; /* 스크롤바 숨김 */
}

/* 스크롤바 숨김 */
.guide-tabs-grid::-webkit-scrollbar {
    display: none;
}

/* PC: 3개씩 2줄 */
.guide-tabs-grid .guide-tab-btn {
    justify-content: flex-start;
    padding: 12px 14px;
    font-size: 13px;
    border-radius: 10px;
    white-space: normal;
    text-align: left;
    line-height: 1.4;
    min-height: 56px;
    align-items: center;
    scroll-snap-align: start;
}

.guide-tabs-grid .guide-tab-btn img {
    flex-shrink: 0;
}


/* 모바일: 2개씩 2줄 */
@media screen and (max-width: 768px) {
    .guide-tabs-wrapper {
        padding: 0 32px;
    }
    
    .tabs-arrow {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .guide-tabs-grid {
        grid-auto-columns: calc((100% - 8px) / 2);
        gap: 8px;
    }
    
    .guide-tabs-grid .guide-tab-btn {
        padding: 10px 12px;
        font-size: 11px;
        min-height: 52px;
    }
}

/* 작은 모바일 */
@media screen and (max-width: 400px) {
    .guide-tabs-grid .guide-tab-btn {
        padding: 8px 10px;
        font-size: 10px;
        min-height: 48px;
    }
}

/* 모바일 반응형 */
@media screen and (max-width: 480px) {
    .horizontal-scroll-container {
        padding-right: 20px;
        gap: 12px;
    }
    
    .guide-card {
        flex: 0 0 85%;
        scroll-snap-align: center;
        padding: 16px;
        min-width: auto;
    }

    .guide-card h4 {
        font-size: 15px;
    }
}
