/*
 * 알쓸정보 목록 페이지 - 모던 반응형 디자인
 * 강조 색상: #008f8c
 */

/* ========================================
   상세 페이지 헤더 설정
   ======================================== */
/* 상세 페이지(show.blade.php)에서 모바일 헤더 및 탭 네비게이션 숨김 */
@media (max-width: 1023px) {
    .content-detail-page #header {
        display: none !important;
    }

    .content-detail-page .tab_nav.common {
        display: none !important;
    }
}

/* PC 페이지 타이틀 */
.page-title-pc {
    display: none;
}

@media (min-width: 1024px) {
    .page-title-pc {
        display: block;
        font-size: 2rem;
        font-weight: 700;
        color: var(--text-primary, #1a1a1a);
        text-align: center;
        padding: 2rem 0 1rem;
        margin: 0 auto;
        max-width: 768px;
    }
}

.fcontents {
    background: var(--bg-gray, #f8f9fa);
    min-height: 100vh;
    padding: 0.5rem 0 2rem 0;
}

/* 세그먼트 바 (카테고리 탭) */
.segment-bar {
    display: flex;
    overflow-x: auto;
    background: var(--bg-white, #ffffff);
    padding: 0 1rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e5e5e5);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.segment-bar::-webkit-scrollbar {
    display: none;
}

@media (min-width: 768px) {
    .segment-bar {
        padding: 0 2rem;
        justify-content: center;
    }
}

.segment {
    position: relative;
    padding: 1rem 0;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.segment-text {
    font-size: clamp(0.9375rem, 2.5vw, 1.0625rem);
    font-weight: 600;
    color: var(--text-light, #999);
    transition: all 0.3s ease;
}

.segment[data-active="true"] .segment-text {
    color: var(--primary-color, #008f8c);
    font-weight: 700;
}

.active-line {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color, #008f8c);
    border-radius: 3px 3px 0 0;
    opacity: 0;
    transition: all 0.3s ease;
}

.segment[data-active="true"] .active-line {
    opacity: 1;
}

/* 콘텐츠 컨테이너 */
.container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 1rem;
}

@media (min-width: 768px) {
    .container {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        padding: 1.5rem 2rem;
    }
}

@media (min-width: 1024px) {
    .container {
        grid-template-columns: repeat(4, 1fr);
    }
}

.contents-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
}

.contents-row:hover {
    transform: translateY(-4px);
}

.contents-img {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.contents-row:hover .contents-img {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.contents-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.contents-row:hover .contents-img img {
    transform: scale(1.08);
}

.contents-title {
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

/* 로딩 인디케이터 */
#loading-indicator {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light, #999);
}

#loading-indicator p {
    margin: 0;
    font-size: 1rem;
}

/* 빈 상태 */
.container > .contents-row > p {
    text-align: center;
    padding: 0.2rem 0.2rem;
    color: var(--text-light, #999);
    font-size: 1rem;
    grid-column: 1 / -1;
}

/* ========================================
   Content Detail Page
   ======================================== */

/* 페이지 컨테이너 */
.content-detail-page {
    background: var(--bg-white, #ffffff);
    min-height: 100vh;
    padding-bottom: 2rem;
}

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

@media (min-width: 768px) {
    .content-container {
        padding: 2rem;
    }
}

/* 콘텐츠 헤더 */
.content-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #e5e5e5);
}

.category-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: var(--primary-color, #008f8c);
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

.content-title {
    font-size: clamp(1.375rem, 4vw, 1.75rem);
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.4;
    margin: 0.5rem 0;
}

.content-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.75rem;
}

.content-meta span {
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
}

/* 썸네일 */
.content-thumbnail {
    margin-bottom: 2rem;
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
}

.content-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

/* 본문 */
.content-body {
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary, #1a1a1a);
}

.content-body.ck-content {
    word-break: break-word;
}

.content-body.ck-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm, 8px);
    margin: 1.5rem 0;
}

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

.content-body.ck-content h2,
.content-body.ck-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

/* 좋아요/공유 버튼 */
.content-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2.5rem 0;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color, #e5e5e5);
    border-bottom: 1px solid var(--border-color, #e5e5e5);
}

.like-btn,
.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 25px;
    background: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition, all 0.3s ease);
}

.like-btn:hover,
.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0, 0, 0, 0.12));
}

.like-btn {
    color: var(--text-primary, #1a1a1a);
}

.like-btn.liked {
    background: #ff4757;
    border-color: #ff4757;
    color: white;
}

.like-btn .like-icon {
    font-size: 1.25rem;
}

.share-btn {
    color: var(--text-secondary, #666);
}

/* 이전/다음글 */
.content-navigation {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-gray, #f8f9fa);
    border-radius: var(--radius-md, 12px);
}

@media (min-width: 768px) {
    .content-navigation {
        flex-direction: row;
        gap: 1rem;
    }
}

.nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: var(--radius-sm, 8px);
    transition: var(--transition, all 0.3s ease);
}

.nav-link:hover {
    border-color: var(--primary-color, #008f8c);
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
}

.nav-label {
    font-size: 0.8125rem;
    color: var(--text-secondary, #666);
    font-weight: 600;
}

.nav-title {
    font-size: 0.9375rem;
    color: var(--text-primary, #1a1a1a);
    font-weight: 500;
}

/* 관련 콘텐츠 */
.related-contents {
    margin: 3rem 0;
}

.related-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 1.5rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .related-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}

.related-card {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    transition: var(--transition, all 0.3s ease);
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0, 0, 0, 0.12));
}

.related-thumb {
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.related-card:hover .related-thumb img {
    transform: scale(1.1);
}

.related-info {
    padding: 1rem;
}

.related-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary, #666);
}

/* 댓글 섹션 */
.comment-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color, #e5e5e5);
}

.comment-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 1.5rem;
}

.comment-count {
    color: var(--primary-color, #008f8c);
}

/* 댓글 작성 폼 */
.comment-form {
    margin-bottom: 2rem;
}

.comment-form form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: var(--radius-sm, 8px);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition, all 0.3s ease);
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color, #008f8c);
}

.comment-form .btn-submit {
    align-self: flex-end;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color, #008f8c);
    color: white;
    border: none;
    border-radius: var(--radius-sm, 8px);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition, all 0.3s ease);
}

.comment-form .btn-submit:hover {
    background: var(--primary-hover, #007370);
}

/* 로그인 필요 메시지 */
.login-required {
    padding: 2rem;
    text-align: center;
    background: var(--bg-gray, #f8f9fa);
    border-radius: var(--radius-sm, 8px);
    margin-bottom: 2rem;
}

.login-required p {
    font-size: 0.9375rem;
    color: var(--text-secondary, #666);
}

.login-required a {
    color: var(--primary-color, #008f8c);
    font-weight: 600;
    text-decoration: underline;
}

/* 댓글 목록 */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 댓글 아이템 */
.comment-item {
    padding: 1.25rem;
    background: var(--bg-gray, #f8f9fa);
    border-radius: var(--radius-sm, 8px);
    border: 1px solid #e9ecef;
}

.comment-child {
    background: white;
    margin-left: 2.5rem;
    margin-top: 0.9375rem;
    border-left: 3px solid var(--primary-color, #008f8c);
}

@media (max-width: 768px) {
    .comment-child {
        margin-left: 1.25rem;
    }
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.625rem;
    }
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.comment-author strong {
    font-size: 0.875rem;
    color: #1f2937;
}

.comment-date {
    font-size: 0.75rem;
    color: #6b7280;
}

.reply-icon {
    color: #4F46E5;
    font-size: 0.875rem;
}

/* 댓글 액션 버튼 */
.comment-actions {
    display: flex;
    gap: 0.625rem;
    align-items: center;
}

.reply-like-btn {
    display: flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.25rem 0.625rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: all 0.2s;
}

.reply-like-btn:hover {
    border-color: #ff4757;
}

.reply-like-btn.liked {
    border-color: #ff4757;
    background: #ff4757;
    color: white;
}

.btn-delete-comment,
.btn-reply {
    padding: 0.25rem 0.625rem;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.8125rem;
}

.btn-delete-comment:hover {
    color: #dc3545;
}

.btn-reply:hover {
    color: #4F46E5;
}

/* 댓글 내용 */
.comment-content {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #1f2937;
    white-space: pre-wrap;
}

/* 답글 작성 폼 */
.reply-form {
    margin-top: 0.9375rem;
    padding-top: 0.9375rem;
    border-top: 1px solid #e9ecef;
}

.reply-form textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: inherit;
    margin-bottom: 0.625rem;
}

.btn-submit-reply {
    padding: 0.5rem 1rem;
    background: #4F46E5;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8125rem;
}

.btn-submit-reply:hover {
    background: #4338ca;
}

.reply-children {
    margin-top: 0.9375rem;
}

/* 신고된 댓글 메시지 */
.reported-message {
    color: #dc3545;
    font-style: italic;
    font-size: 0.8125rem;
}

/* 신고 모달 */
.report-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.report-modal-content {
    background: white;
    padding: 1.875rem;
    border-radius: var(--radius-md, 12px);
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .report-modal-content {
        padding: 1.25rem;
    }
}

.report-modal-content h4 {
    margin: 0 0 1.25rem 0;
    font-size: 1.125rem;
    color: #1f2937;
    text-align: center;
}

.report-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem 0;
}

.report-item {
    padding: 0.75rem 0.9375rem;
    margin-bottom: 0.5rem;
    background: var(--bg-gray, #f8f9fa);
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    color: #1f2937;
}

.report-item:hover {
    background: #4F46E5;
    color: white;
    border-color: #4F46E5;
}

.btn-cancel-report {
    width: 100%;
    padding: 0.625rem;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-cancel-report:hover {
    background: #4b5563;
}

/* ========================================
   PC 레이아웃 (1024px+)
   ======================================== */
@media (min-width: 1024px) {
    /* 전체 컨테이너 */
    .fcontents,
    .contents-page {
        max-width: 768px;
        margin: 0 auto;
    }

    /* 세그먼트 바 */
    .segment-bar {
        padding: 0 2rem;
        max-width: 768px;
        margin: 0 auto;
    }

    /* 콘텐츠 그리드 컨테이너 - 최대 3열로 제한 */
    .container {
        padding: 1.5rem 1rem;
        grid-template-columns: repeat(3, 1fr);
    }

    /* 콘텐츠 상세 페이지 */
    .content-detail-page {
        max-width: 768px;
        margin: 0 auto;
    }

    .content-container {
        max-width: 768px;
        margin: 0 auto;
        padding: 2rem;
    }

    .content-header {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }

    .content-title {
        font-size: clamp(1.75rem, 3vw, 2.25rem);
    }
}
