/**
 * Native Ad System CSS
 * 사이트 디자인과 조화로운 네이티브 광고 스타일
 */

/* ========================================
   공통 광고 스타일
   ======================================== */

.ad-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.ad-container:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(76, 175, 80, 0.3);
}

/* 광고 라벨 */
.ad-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 4px;
}

/* 광고 헤더 */
.ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* 광고 업그레이드 힌트 */
.ad-upgrade-hint {
    background: none;
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4CAF50;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.ad-upgrade-hint:hover {
    background: rgba(76, 175, 80, 0.1);
    border-color: #4CAF50;
    transform: translateY(-1px);
}

/* 광고 콘텐츠 영역 */
.ad-content {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

/* 광고 닫기 버튼 */
.ad-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #888;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    z-index: 10;
}

.ad-close:hover {
    background: rgba(255, 0, 0, 0.3);
    color: white;
    transform: scale(1.1);
}

/* ========================================
   사이드바 네이티브 광고
   ======================================== */

.sidebar-native-ad {
    margin-top: 30px;
    padding: 0 10px;
}

.sidebar-native-ad .ad-container {
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-native-ad .ad-content {
    min-height: 62px;
    width: 100%;
}

.sidebar-native-ad .ad-label {
    text-align: center;
    display: block;
    width: 100%;
}

/* ========================================
   분석 패널 하단 광고
   ======================================== */

.analysis-bottom-ad {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ad-separator {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.ad-separator::before,
.ad-separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.ad-separator::before {
    left: 0;
}

.ad-separator::after {
    right: 0;
}

.ad-separator span {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 0 15px;
    background: #1a1a1a;
    position: relative;
    z-index: 1;
}

.analysis-bottom-ad .ad-content {
    max-width: 728px;
    margin: 0 auto;
    min-height: 90px;
}

/* ========================================
   페이지 하단 광고
   ======================================== */

.page-bottom-ad {
    margin: 40px 0 20px 0;
    padding: 30px 20px;
    background: rgba(0, 0, 0, 0.2);
}

.page-bottom-ad .ad-container {
    max-width: 970px;
    margin: 0 auto;
}

.page-bottom-ad .ad-content {
    min-height: 90px;
}

/* ========================================
   모바일 광고
   ======================================== */

@media (max-width: 768px) {
    /* 사이드바 광고 숨김 (모바일) */
    .sidebar-native-ad {
        display: none;
    }

    /* 분석 하단 광고 */
    .analysis-bottom-ad .ad-content {
        max-width: 100%;
        min-height: 50px;
    }

    /* 모바일 전용 하단 광고 */
    .mobile-bottom-ad {
        display: block;
        padding: 20px 10px;
        text-align: center;
        background: rgba(0, 0, 0, 0.3);
        position: fixed;
        bottom: 60px; /* 플로팅 탭 위 */
        left: 0;
        right: 0;
        z-index: 999;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-bottom-ad .ad-content {
        max-width: 320px;
        margin: 0 auto;
        min-height: 50px;
    }

    .mobile-bottom-ad .ad-close {
        top: 5px;
        right: 5px;
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
}

/* ========================================
   프리미엄 사용자 - 광고 숨김
   ======================================== */

body.premium-user .sidebar-native-ad,
body.premium-user .analysis-bottom-ad,
body.premium-user .page-bottom-ad,
body.premium-user .mobile-bottom-ad {
    display: none !important;
}

/* ========================================
   광고 로딩 상태
   ======================================== */

.ad-loading {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
}

.ad-loading::after {
    content: 'Loading...';
    animation: ad-loading-pulse 1.5s infinite;
}

@keyframes ad-loading-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ========================================
   광고 에러 상태
   ======================================== */

.ad-error {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 11px;
    text-align: center;
    padding: 20px;
}

/* ========================================
   업그레이드 CTA 카드
   ======================================== */

.upgrade-cta-card {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 152, 0, 0.1) 100%);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 193, 7, 0.2);
        border-color: rgba(255, 193, 7, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.4);
        border-color: rgba(255, 193, 7, 0.5);
    }
}

.upgrade-cta-card .cta-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upgrade-cta-card h3 {
    color: #FFC107;
    font-size: 18px;
    margin-bottom: 10px;
}

.upgrade-cta-card p {
    color: #ccc;
    font-size: 14px;
    margin-bottom: 15px;
}

.upgrade-cta-card .cta-features {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.upgrade-cta-card .cta-features li {
    padding: 8px 0;
    color: #aaa;
    font-size: 14px;
}

.btn-upgrade {
    background: linear-gradient(135deg, #FFC107, #FF9800);
    color: #000;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 193, 7, 0.4);
}

/* ========================================
   광고와 함께 표시되는 프리미엄 힌트
   ======================================== */

.ad-with-upgrade-hint {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ad-upgrade-footer {
    text-align: center;
    padding: 10px;
    background: rgba(76, 175, 80, 0.05);
    border-radius: 8px;
    font-size: 12px;
    color: #888;
}

.ad-upgrade-footer a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 600;
    margin-left: 5px;
}

.ad-upgrade-footer a:hover {
    color: #66BB6A;
    text-decoration: underline;
}

/* ========================================
   광고 차단기 감지 메시지
   ======================================== */

.adblock-notice {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    display: none;
}

.adblock-notice.show {
    display: block;
}

.adblock-notice p {
    color: #FF9800;
    font-size: 13px;
    margin-bottom: 10px;
}

.adblock-notice button {
    background: linear-gradient(135deg, #FFC107, #FF9800);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

/* ========================================
   게스트 사용자 광고 제어
   ======================================== */

/* 게스트(비로그인) 사용자는 Remove Ads 링크 숨김 */
body:not(.authenticated-user) .ad-upgrade-hint {
    display: none !important;
}

/* 게스트(비로그인) 사용자는 닫기 버튼 숨김 */
body:not(.authenticated-user) .ad-close {
    display: none !important;
}

/* 로그인 사용자는 Remove Ads 링크 표시 */
body.authenticated-user .ad-upgrade-hint {
    display: inline-block;
}

/* 로그인 사용자는 닫기 버튼 표시 */
body.authenticated-user .ad-close {
    display: block;
}


/* ========================================
   차트 하단 광고 3개 가로 배치
   ======================================== */

.chart-bottom-ads {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.chart-ads-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.chart-ad-item {
    min-width: 0; /* 그리드 아이템이 컨테이너 밖으로 나가지 않도록 */
}

.chart-ad-item .ad-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chart-ad-item .ad-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 프리미엄 사용자는 차트 광고 숨김 */
body.premium-user .chart-bottom-ads {
    display: none !important;
}

/* 모바일 반응형 */
@media (max-width: 1024px) {
    .chart-ads-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-ad-item:last-child {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .chart-ads-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-ad-item:last-child {
        grid-column: span 1;
    }
}

