/* 공통 스타일들을 모아놓은 파일 - 다크모드 지원 */

/* CSS 변수는 이미 header.php에 정의되어 있음 */

/* 전역 스타일 보정 */
body {
    background: var(--bg-color);
    color: var(--text-primary);
}

/* 페이지 컨테이너 스타일 */
.container {
    background: transparent;
}

/* 메인 컨텐츠 스타일 */
.main {
    padding: 40px 0;
}

.section-title {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.section-subtitle {
    font-size: 19px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-weight: 400;
    transition: color 0.3s ease;
}

/* 기간 선택 탭 스타일 */
.period-tabs {
    display: flex;
    background: var(--hover-bg);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 30px;
    gap: 2px;
    width: fit-content;
    transition: background-color 0.3s ease;
}

.period-tab {
    padding: 8px 20px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.period-tab:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

[data-theme="dark"] .period-tab:hover {
    background: var(--surface-color);
}

.period-tab.active {
    background: var(--surface-color);
    color: var(--accent-color);
    box-shadow: 0 1px 3px var(--card-shadow);
}

/* 인기 카테고리가 아닐 때 기간 탭 숨김 */
.period-tabs.hidden {
    display: none;
}

/* 웹진 스타일 리스트 */
.deals-list {
    background: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.deal-item {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s ease;
    cursor: pointer;
}

.deal-item:last-child {
    border-bottom: none;
}

.deal-item:hover {
    background: var(--hover-bg);
}

.deal-content {
    display: flex;
    padding: 16px 20px;
    gap: 16px;
    align-items: center;
}

.deal-image {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    color: white;
    overflow: hidden;
}

.deal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.deal-image-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    color: white;
}

.deal-info {
    flex: 1;
    min-width: 0;
}

.deal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.deal-category {
    background: var(--hover-bg);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] .deal-category {
    background: var(--surface-color);
    color: var(--text-secondary);
}

/* 커뮤니티 파비콘 스타일 */
.community-favicon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--hover-bg);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.community-favicon img {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.community-favicon-emoji {
    font-size: 12px;
    line-height: 1;
}

.deal-site {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 400;
    transition: color 0.3s ease;
}

.deal-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.deal-price-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.deal-prices {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.current-price {
    font-size: 16px;
    font-weight: 600;
    color: #ff3b30;
}

.shipping-info {
    font-size: 12px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* 시간 기반 색상 클래스들 - 다크모드 고려 */
.time-fresh {
    color: #28a745 !important;  /* 30분 이내 - 초록색 */
    font-weight: 600;
}

[data-theme="dark"] .time-fresh {
    color: #40d15a !important;  /* 다크모드에서 더 밝은 초록색 */
}

.time-recent {
    color: #007bff !important;  /* 30분-3시간 - 파란색 */
    font-weight: 600;
}

[data-theme="dark"] .time-recent {
    color: #409cff !important;  /* 다크모드에서 더 밝은 파란색 */
}

.time-medium {
    color: #fd7e14 !important;  /* 3-24시간 - 주황색 */
    font-weight: 500;
}

[data-theme="dark"] .time-medium {
    color: #ff922b !important;  /* 다크모드에서 더 밝은 주황색 */
}

.time-old {
    color: var(--text-secondary) !important;  /* 1일 이상 - 회색 */
    font-weight: 400;
}

/* 상대 시간 스타일 */
.relative-time {
    font-size: 12px;
}

.deal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.deal-time {
    color: var(--text-secondary);
    font-size: 11px;
    transition: color 0.3s ease;
}

.deal-views {
    color: var(--text-secondary);
    font-size: 11px;
    transition: color 0.3s ease;
}

.no-deals {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* 더보기 버튼 스타일 */
.load-more-container {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
}

.load-more-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.load-more-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

.deals-end-message {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-light);
    margin-top: 20px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

/* 새로운 콘텐츠 구분선 스타일 */
.new-content-divider {
    position: relative;
    margin: 20px 0;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    animation: slideIn 0.5s ease-out forwards;
}

.new-content-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #ff3b30 20%, #ff3b30 80%, transparent 100%);
    transform: translateY(-50%);
}

.new-content-divider .divider-text {
    background: var(--surface-color);
    color: #ff3b30;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid #ff3b30;
    border-radius: 16px;
    display: inline-block;
    position: relative;
    z-index: 1;
    transition: background-color 0.3s ease;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 로딩 스피너 스타일 (기존 코드의 hotdeal- 접두사 클래스들) */
.hotdeal-initial-loading {
    text-align: center;
    padding: 60px 20px;
}

.hotdeal-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: hotdeal-spin 1s linear infinite;
    margin: 0 auto 20px;
    transition: border-color 0.3s ease;
}

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

.hotdeal-initial-loading p {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0;
    transition: color 0.3s ease;
}

.hotdeal-error-message {
    text-align: center;
    padding: 40px 20px;
}

.hotdeal-error-message p {
    color: #e74c3c;
    margin-bottom: 20px;
    font-size: 16px;
}

[data-theme="dark"] .hotdeal-error-message p {
    color: #ff6b6b;
}

.hotdeal-retry-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.hotdeal-retry-btn:hover {
    background-color: var(--accent-hover);
}

/* 반응형 */
@media (max-width: 768px) {
    .main {
        padding: 20px 0;
    }

    .section-title {
        font-size: 28px;
    }

    .section-subtitle {
        font-size: 17px;
        margin-bottom: 20px;
    }

    .period-tabs {
        margin-bottom: 20px;
        width: 100%;
        justify-content: center;
    }

    .period-tab {
        flex: 1;
        text-align: center;
        padding: 10px 16px;
        font-size: 13px;
    }

    .deal-content {
        padding: 16px 20px;
        gap: 20px;
    }

    .deal-image,
    .deal-image-placeholder {
        width: 70px;
        height: 70px;
        font-size: 24px;
    }

    .deal-title {
        font-size: 14px;
    }

    .current-price {
        font-size: 15px;
    }

    .new-content-divider .divider-text {
        font-size: 11px;
        padding: 3px 10px;
    }

    .relative-time {
        font-size: 11px;
    }

    .time-fresh,
    .time-recent {
        font-weight: 600;
    }
    
    .time-medium {
        font-weight: 500;
    }
    
    .time-old {
        font-weight: 400;
    }

    .community-favicon {
        font-size: 9px;
        padding: 1px 4px;
    }

    .community-favicon img {
        width: 10px;
        height: 10px;
    }

    .community-favicon-emoji {
        font-size: 10px;
    }

    /* 모바일에서 deal-time과 deal-views 숨기기 */
    .deal-time,
    .deal-views {
        display: none;
    }
}