/* ===================================
   스마트 쇼핑 가이드 - 반응형 스타일
   SEO 최적화 & AdSense 친화적 디자인
   =================================== */

/* 기본 리셋 & 변수 */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-gray: #f9fafb;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --max-width: 1200px;
    --spacing: 1rem;
    --border-radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-gray);
    font-size: 16px;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing);
}

/* ===================================
   AdSense 광고 컨테이너
   =================================== */
.ad-container {
    margin: 1.5rem auto;
    text-align: center;
    min-height: 100px;
    background-color: var(--bg-gray);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-top {
    margin-bottom: 2rem;
    min-height: 90px; /* 수평 광고용 */
}

.ad-sidebar {
    position: sticky;
    top: 20px;
    min-height: 600px; /* 수직 광고용 */
    margin-bottom: 2rem;
}

.ad-bottom {
    margin-top: 2rem;
    min-height: 250px; /* 큰 사각형 광고용 */
}

/* AdSense 광고가 로드되면 테두리 제거 */
.ad-container ins {
    background: transparent;
    border: none;
}

/* ===================================
   헤더 (Header)
   =================================== */
.site-header {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.site-logo a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

.site-logo a:hover {
    color: var(--secondary-color);
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.main-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: var(--primary-color);
}

/* ===================================
   메인 콘텐츠
   =================================== */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* 히어로 섹션 */
.hero-section {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: var(--border-radius);
    margin-bottom: 3rem;
}

.hero-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-section p {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* ===================================
   포스트 그리드 (제품 카드)
   =================================== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.post-card {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.post-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background-color: var(--bg-gray);
}

.post-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-category {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.post-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    color: var(--text-color);
}

.post-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
}

.post-title a:hover {
    color: var(--primary-color);
}

.post-excerpt {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    flex-grow: 1;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-light);
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.post-price {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--success-color);
}

.post-date {
    font-size: 0.85rem;
}

/* ===================================
   로딩 상태
   =================================== */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ===================================
   푸터 (Footer)
   =================================== */
.site-footer {
    background-color: var(--text-color);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

.site-footer p {
    margin: 0.5rem 0;
}

.disclaimer {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 1rem;
}

/* ===================================
   반응형 디자인 (Mobile First)
   =================================== */

/* 태블릿 (768px 이상) */
@media (min-width: 768px) {
    :root {
        --spacing: 2rem;
    }
    
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .hero-section h2 {
        font-size: 3rem;
    }
}

/* 데스크탑 (1024px 이상) */
@media (min-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
    
    .hero-section {
        padding: 4rem 2rem;
    }
    
    .hero-section h2 {
        font-size: 3.5rem;
    }
}

/* 모바일 (480px 이하) */
@media (max-width: 480px) {
    .site-header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-nav ul {
        gap: 1rem;
    }
    
    .hero-section h2 {
        font-size: 1.75rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ===================================
   페이지네이션
   =================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
    padding: 2rem 0;
}

.pagination-btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--secondary-color);
}

.pagination-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.pagination-info {
    font-weight: 600;
    color: var(--text-color);
}

/* ===================================
   가격 표시
   =================================== */
.current-price {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--success-color);
}

.original-price {
    font-size: 0.9rem;
    color: var(--text-light);
    text-decoration: line-through;
    margin-left: 0.5rem;
}

.discount-badge {
    display: inline-block;
    background-color: var(--warning-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

/* ===================================
   에러 & 빈 상태 메시지
   =================================== */
.error-message,
.no-posts {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.error-message p,
.no-posts p {
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

.error-message p:first-child,
.no-posts p:first-child {
    font-size: 2rem;
}

/* ===================================
   접근성 & SEO
   =================================== */

/* 포커스 아웃라인 */
a:focus,
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 이미지 대체 텍스트 스타일 */
img:not([alt]) {
    border: 3px dashed red; /* 개발 중 alt 누락 확인용 */
}

/* 프린트 스타일 */
@media print {
    .ad-container,
    .site-header,
    .site-footer {
        display: none;
    }
    
    .post-card {
        break-inside: avoid;
    }
}
