/* VibeAZ Detail Page Styles */

/* 전체 레이아웃 */
body.detail-open {
    overflow: hidden;
}

.detail-page-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 1000;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-page-container.visible {
    transform: translateX(0);
}

/* 메인 헤더 스크롤 숨김/표시 스타일 */
.header {
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateY(0);
}

.header.header-hidden {
    transform: translateY(-100%);
    pointer-events: none;
}

/* 상세 페이지 헤더 스타일 */
.detail-header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e9ecef;
    z-index: 100;
    padding: 0.75rem 0;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateY(0);
    opacity: 1;
}

.detail-header.header-hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.detail-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.detail-back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.detail-back-button:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #343a40;
}

.detail-back-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.detail-header-title {
    font-size: 1rem;
    font-weight: 600;
    color: #343a40;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* 메인 콘텐츠 */
.detail-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

.detail-article {
    max-width: 800px;
    margin: 0 auto;
}

/* 아티클 헤더 */
.article-header {
    text-align: center;
    margin: 0 0 3rem;
}

.article-title {
    font-size: 2.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1.5rem;
    line-height: 1.3;
    word-break: keep-all;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.meta-date, .meta-category {
    font-weight: 500;
}

/* 로딩 및 에러 상태 */
.detail-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top: 3px solid var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.detail-error {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.detail-error h2 {
    color: #333;
    margin-bottom: 1rem;
}

.detail-error button {
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

/* 연관 콘텐츠 그리드 */
.related-section {
    margin: 4rem 0 2rem;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.related-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: #333;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    justify-items: center;
}

.related-item {
    width: 280px;
    height: 280px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
    position: relative;
    cursor: pointer;
}

.related-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.related-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 카테고리별 배경색 */
.related-thumbnail.design {
    background: linear-gradient(135deg, #f06595 0%, #f5576c 100%);
}

.related-thumbnail.marketing {
    background: linear-gradient(135deg, #9775fa 0%, #7c3aed 100%);
}

.related-thumbnail.dev {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
}

.related-thumbnail.planning {
    background: linear-gradient(135deg, #f9c74f 0%, #f59f00 100%);
}

.related-thumbnail.trend {
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
}

.related-thumbnail.vibecoding {
    background: linear-gradient(135deg, #7950f2 0%, #6b46c1 100%);
}

/* 오버레이 */
.related-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 2rem 1rem 1rem;
    color: white;
}

.related-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-meta {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.related-meta .value-bar {
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.related-meta .progress-bar {
    width: 40px;
    height: 6px;
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
    overflow: hidden;
}

.related-meta .progress-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.related-meta .value-high { background: #51cf66; }
.related-meta .value-medium { background: #f9c74f; }
.related-meta .value-low { background: #f06595; }

/* 광고 카드 */
.ad-card {
    width: 325px;
    height: 350px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
}

.ad-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    z-index: 10;
}

/* 태블릿 */
@media (max-width: 992px) {
    .detail-header-content {
        padding: 0 1rem;
    }
    
    .article-title {
        font-size: 1.8rem;
    }
    
    .article-meta {
        gap: 0.75rem;
        font-size: 0.85rem;
    }
    
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .related-item {
        width: 100%;
        height: 240px;
        min-width: 140px;
    }
}

/* 모바일 */
@media (max-width: 768px) {
    .detail-header-content {
        padding: 0 0.75rem;
    }
    
    .detail-back-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .detail-back-button svg {
        width: 16px;
        height: 16px;
    }
    
    .detail-header-title {
        font-size: 0.9rem;
    }
    
    .detail-main {
        padding: 0 0.75rem 1.5rem;
    }
    
    .article-header {
        /**margin: 1.5rem 0 2rem;**/
    }
    
    .article-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .article-meta {
        /**flex-direction: column;**/
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    .related-section {
        margin: 0rem 0 1.5rem;
        padding: 1.5rem;
    }
    
    .related-title {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .related-item {
        height: 260px;
        max-width: 100%;
    }
    
    .related-overlay {
        padding: 1.5rem 0.75rem 0.75rem;
    }
    
    .related-item-title {
        font-size: 0.85rem;
    }
    
    .ad-card {
        width: 100%;
        max-width: 100%;
    }
}

/* 작은 모바일 */
@media (max-width: 480px) {
    .detail-header-content {
        gap: 0.5rem;
    }
    
    .detail-back-button span {
        display: none; /* 작은 화면에서는 텍스트 숨김 */
    }
    
    .article-title {
        font-size: 1.3rem;
        line-height: 1.4;
    }
    
    .article-meta {
        font-size: 0.75rem;
    }
}

/* 다크 모드 지원 (선택사항) */
@media (prefers-color-scheme: dark) {
    .detail-page-container {
        background: #1a1a1a;
        color: #e9ecef;
    }
    
    .detail-header {
        background: rgba(26, 26, 26, 0.95);
        border-bottom-color: #343a40;
    }
    
    .detail-back-button {
        background: transparent;
        border-color: #495057;
        color: #adb5bd;
    }
    
    .detail-back-button:hover {
        background: #343a40;
        border-color: #6c757d;
        color: #e9ecef;
    }
    
    .detail-header-title,
    .article-title {
        color: #45719d;
    }
    
    .related-section {
        background: #b8c4d0;
    }
    
    .related-item {
        background: #ffffff;
    }
    
    .related-title {
        color: #e9ecef;
    }
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    .detail-header {
        background: #fff;
        border-bottom: 2px solid #000;
    }
    
    .detail-back-button {
        border: 2px solid #000;
        color: #000;
    }
    
    .detail-back-button:hover {
        background: #000;
        color: #fff;
    }
}

/* 애니메이션 감소 설정 */
@media (prefers-reduced-motion: reduce) {
    .detail-page-container,
    .detail-header,
    .related-item,
    .detail-back-button {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
        border: 3px solid var(--brand-primary);
        border-radius: 50%;
    }
}