/* Detail Router CSS - 메인 페이지와 일치하는 밝은 테마 */

/* 상세 페이지 열림 상태 스타일 */
body.detail-page-open {
    overflow: hidden;
}

body.detail-page-open > *:not(#detail-page-container) {
    display: none !important;
}

/* 기본 설정 */
#detail-page-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    color: #333333;
    z-index: 9999;
    overflow-y: auto;
    overflow-x: hidden;
    font-family: 'Noto Sans KR', sans-serif;
}

/* 메인 페이지 완전 숨김 보장 */
#detail-page-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: -1;
}

/* 헤더 스타일 */
#detail-page-container .header {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
    position: relative;
    z-index: 10000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 상세 페이지 컨테이너 내부의 container는 더 좁게 */
#detail-page-container .container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

#detail-page-container .header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.logo-container:hover {
    transform: scale(1.05);
}

.logo-container h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: #333333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 0;
}

.nav a:hover {
    color: #667eea;
}

.back-button {
    background: transparent;
    border: 1px solid #ddd;
    color: #666;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-button:hover {
    background: #f5f5f5;
    border-color: #ccc;
    color: #333;
}

/* 아티클 컨테이너 */
.article-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
    padding-top: 140px; /* fixed header 높이 + 여백 증가 */
    padding-bottom: 20px; /* fixed footer 높이 + 여백 */
}

/* 아티클 헤더 */
.article-header {
    text-align: center;
    margin: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e0e0e0;
    z-index: 100;
    padding: 0.5rem 0;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateY(0);
    opacity: 1;
}

.article-header.header-hidden {
    transform: translateY(-100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.back-button-container {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0.5rem;
    padding: 0 1rem;
}

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

.article-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    color: #666;
    font-size: 0.8rem;
    margin: 0;
    overflow-x: auto;
    white-space: nowrap;
}

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

.content-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    color: white;
    font-weight: 500;
    font-size: 0.8rem;
}

.domain-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.domain-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 10px;
}

.value-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.progress-bar {
    width: 60px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

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

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

/* AI 추천 섹션 */
.ai-summary {
    background: linear-gradient(135deg, #9775fa 0%, #7c3aed 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.ai-summary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.ai-summary h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.ai-summary p {
    font-size: 1rem;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

/* 키워드 섹션 */
.keywords-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.keywords-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #333;
}

.keywords-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-tag {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
}

.keyword-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 171, 247, 0.3);
}

/* 썸네일 */
.thumbnail-container {
    width: 100%;
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.article-thumbnail {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.article-thumbnail:hover {
    transform: scale(1.02);
}

.thumbnail-fallback {
    width: 100%;
    height: 100px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 600;
}

/* 콘텐츠 본문 */
.content-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
    margin: 2rem 0;
}

.content-body h3 {
    font-size: 1.5rem;
    color: #333;
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #4dabf7;
}

.content-body p {
    margin-bottom: 1.5rem;
}

.content-body ul {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.content-body li {
    margin-bottom: 0.8rem;
}

.content-body strong {
    color: #4dabf7;
    font-weight: 600;
}

/* 리소스 섹션 */
.github-resources {
    margin: 2rem 0;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.github-resources h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.github-link {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.3s ease;
}

.github-link:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.github-link-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.github-link-desc {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.github-link-relevance {
    color: #51cf66;
    font-size: 0.8rem;
    font-weight: 500;
}

.github-link a {
    display: inline-block;
    margin-top: 0.5rem;
    color: #4dabf7;
    text-decoration: none;
    font-size: 0.9rem;
}

.github-link a:hover {
    text-decoration: underline;
}

/* 원문 링크 */
.source-link {
    text-align: center;
    margin: 3rem 0;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.source-link h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #333;
}

.source-link a {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: transform 0.3s, box-shadow 0.3s;
}

.source-link a:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* 액션 푸터 */
.action-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e0e0e0;
    z-index: 150;
    padding: 1rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateY(0);
    opacity: 1;
}

.action-footer.footer-hidden {
    transform: translateY(100%) !important;
    opacity: 0 !important;
    pointer-events: none;
}

/* 푸터 버튼 스타일 */
.btn-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 80px;
    text-decoration: none;
}

.btn-footer i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.btn-footer span {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.btn-back {
    color: #6c757d;
}

.btn-back:hover {
    background: rgba(108, 117, 125, 0.1);
    color: #495057;
    transform: translateY(-1px);
}

.btn-share {
    color: #4dabf7;
}

.btn-share:hover {
    background: rgba(77, 171, 247, 0.1);
    color: #339af0;
    transform: translateY(-1px);
}

.btn-share:active {
    transform: translateY(0);
}

/* 로딩 상태 */
.btn-share.loading {
    opacity: 0.7;
    pointer-events: none;
}

.btn-share.loading i {
    animation: spin 1s linear infinite;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background-color: #4dabf7;
    color: white;
}

.btn-primary:hover {
    background-color: #339af0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-secondary {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background-color: #e9ecef;
    color: #495057;
}

/* 연관 콘텐츠 */
.related-section {
    margin: 4rem auto 2rem auto;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
}

.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(200px, 1fr));
    gap: 0.5rem;
    justify-items: center;
}

.related-item {
    width: 100%;
    max-width: 320px;
    min-width: 320px;
    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.dev {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
}

.related-thumbnail.design {
    background: linear-gradient(135deg, #f06595 0%, #f5576c 100%);
}

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

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

.related-thumbnail.trend {
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 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;
}

/* 광고 카드 */
.ad-card {
    background: #fff;
    border: 1px solid #e0e0e0;
}

.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;
}

.ad-container {
    width: 100%;
    height: 100%;
    min-width: 320px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* 푸터 */
.footer {
    background: #333;
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 0.8;
}

/* 로딩 스피너 */
.detail-loading, .related-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #4dabf7;
    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: #4dabf7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    /* 아티클 컨테이너 */
    .article-content {
        padding-top: 20px; /* 모바일에서 헤더 높이 조정 */
    }
    
    /* 아티클 헤더 */
    .article-header {
        padding: 0.3rem 0;
    }
    
    .back-button-container {
        margin-bottom: 0.3rem;
        padding: 0 0.5rem;
    }
    
    .article-title {
        font-size: 1.6rem;
        margin: 0 0 0.3rem 0;
        line-height: 1.2;
        padding: 0 0.5rem;
    }
    
    .article-meta {
        flex-wrap: nowrap;
        gap: 0.3rem;
        font-size: 0.7rem;
        justify-content: flex-start;
        padding: 0 0.5rem;
        overflow-x: auto;
    }
    
    .article-meta span {
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    /* AI 추천 섹션 모바일 최적화 */
    .ai-summary {
        margin: 10.5rem 0 0  0;
        padding: 1rem;
        border-radius: 8px;
    }
    
    .ai-summary h2 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .ai-summary p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* 모바일 섹션 간 마진 대폭 축소 */
    .content-body {
        margin: 1rem 0;
    }
    
    .keywords-section {
        margin: 1rem 0;
        padding: 1rem;
    }
    
    .github-resources {
        margin: 1rem 0;
        padding: 1rem;
    }
    
    .source-link {
        margin: 1.5rem 0;
        padding: 1rem;
    }
    
    .related-section {
        margin: 1.5rem 0 1rem;
        padding: 1rem;
    }
    
    /* 액션 푸터 모바일 최적화 */
    .action-footer {
        padding: 0.25rem 1rem;
        gap: 2rem;
    }
    
    .btn-footer {
        min-width: 70px;
        padding: 0.5rem 0.75rem;
    }
    
    .btn-footer i {
        font-size: 1.1rem;
    }
    
    .btn-footer span {
        font-size: 0.75rem;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .related-item {
        width: 100%;
        height: 260px;
        max-width: 100%;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .back-button span {
        display: none;
    }
    
    .article-title {
        font-size: 1.5rem;
        line-height: 1.4;
    }
    
    .article-meta {
        font-size: 0.75rem;
    }
    
    .related-item {
        height: 240px;
    }
    
    .related-overlay {
        padding: 1.5rem 0.75rem 0.75rem;
    }
    
    .related-item-title {
        font-size: 0.85rem;
    }
}

/* 애니메이션 감소 설정 */
@media (prefers-reduced-motion: reduce) {
    .related-item,
    .back-button,
    .btn,
    .keyword-tag {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
        border: 3px solid #4dabf7;
        border-radius: 50%;
    }
    
    .ai-summary::before {
        animation: none;
    }
}