/* 공통 스타일 - 모든 컨텐츠 페이지에서 사용 (모바일 터치 친화) */

/* 하단 배너 높이 변수 */
:root {
    --fixed-banner-height: 50px;
}

/* 모바일: 터치 시 하이라이트 제거, 가로 스크롤 방지, pull-to-refresh 방지 */
body {
    overscroll-behavior-y: none; /* pull-to-refresh(당겨서 새로고침) 방지 */
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* 뒤로가기 버튼 */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 30px;
    padding: 10px 20px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-md);
    backdrop-filter: blur(15px);
    border: 1.5px solid rgba(255, 182, 193, 0.3);
    box-shadow: 0 4px 12px rgba(255, 182, 193, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.back-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.back-button:hover::before {
    left: 100%;
}

.back-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateX(-6px) translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 182, 193, 0.3);
    border-color: var(--primary-pink);
    color: var(--primary-pink);
}

.back-button:active {
    transform: translateX(-4px) translateY(0);
}

.back-button span {
    font-size: 16px;
    font-weight: 700;
    transition: transform 0.3s ease;
}

.back-button:hover span {
    transform: translateX(-2px);
}

/* 하단 고정형 배너 */
.fixed-bottom-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 0;
    height: var(--fixed-banner-height, 50px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-banner-content {
    width: 320px;
    height: 50px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bottom-banner-content .kakao_ad_area {
    display: block !important;
}

/* Onpith CPS 배너 스타일 */
.cps-banner {
    width: 100%;
    max-width: 1200px;
    margin: 16px auto 0;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 컨텐츠 띠배너1번 스타일 */
.content-strip-banner-1 {
    width: 100%;
    max-width: 1200px;
    margin: 8px auto 60px;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

.content-strip-banner-1-content {
    width: 320px;
    height: 50px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
}

.content-strip-banner-1-content .kakao_ad_area {
    display: block !important;
}

/* 맨 위로 가기 버튼 (모바일 터치 영역 44px 이상 유지) */
.scroll-to-top {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
    background: var(--gradient-1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: var(--gradient-2);
}

.scroll-to-top:active {
    transform: translateY(-2px);
}

.scroll-to-top span {
    display: block;
    line-height: 1;
}

/* 반응형 */
@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 80px;
        right: 16px;
    }
    
    .cps-banner {
        margin: 12px auto 0;
        padding: 0 16px;
    }

    .content-strip-banner-1 {
        margin: 8px auto 50px;
        padding: 0 16px;
    }
}

/* 전면 광고 레이어 (컨텐츠 페이지) */
.ad-layer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.ad-layer-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ad-layer-container {
    position: relative;
    background: white;
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    width: 360px; /* 320px 광고 + 40px 패딩 */
    min-height: 520px; /* 480px 광고 + 40px 패딩 */
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ad-layer-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: rgba(255, 182, 193, 0.2);
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-dark);
    cursor: pointer;
    display: none; /* 초기에는 숨김, 2초 후 표시 */
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    line-height: 1;
    padding: 0;
    font-family: 'Pretendard', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.ad-layer-close.show {
    display: flex;
}

.ad-layer-close:hover {
    background: var(--primary-pink);
    color: white;
    transform: rotate(90deg);
}

.ad-layer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 320px;
    height: 480px;
    position: relative;
}

.ad-layer-content .kakao_ad_area {
    display: block !important;
    width: 320px;
    height: 480px;
}

/* 로딩 표시 */
.ad-layer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 5;
}

.ad-layer-loading.hidden {
    display: none;
}

.ad-layer-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 182, 193, 0.2);
    border-top-color: var(--primary-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.ad-layer-loading-text {
    font-size: 16px;
    color: var(--text-medium);
    font-weight: 500;
    font-family: 'Pretendard', sans-serif;
}

@media (max-width: 768px) {
    .ad-layer-container {
        width: calc(100% - 40px);
        max-width: 360px;
        padding: 15px;
    }
    
    .ad-layer-content {
        width: 100%;
        max-width: 320px;
        height: auto;
        min-height: 480px;
    }
    
    .ad-layer-close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 20px;
        top: 8px;
        right: 8px;
    }
}
