/* 소프트웨어 다운로드 페이지 스타일 */

/* 페이지 헤더 */
.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    color: #111827;
    font-weight: 700;
    margin: 0;
}

/* 소프트웨어 래퍼 */
.software-wrapper {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 가로 스크롤 방지 */
.content-wrapper {
    overflow-x: hidden;
    word-wrap: break-word;
}

/* 탭 메뉴 */
.tab-menu {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: white;
    padding: 0 20px;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 16px;
    color: #6b7280;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-button:hover {
    color: #374151;
    border-bottom-color: #d1d5db;
}

.tab-button.active {
    color: #1f2937;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}

.tab-count {
    background: #e5e7eb;
    color: #6b7280;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.tab-button.active .tab-count {
    background: #dbeafe;
    color: #3b82f6;
    font-weight: 600;
}

/* 콘텐츠 래퍼 */
.content-wrapper {
    background: white;
    min-height: 400px;
    overflow-x: hidden;
    word-wrap: break-word;
}

/* 로딩 상태 */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.loading-state.hidden {
    display: none;
}



/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #495057;
}

/* 페이지네이션 */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
    color: #667eea;
    padding: 8px 12px;
}

.pagination .page-link:hover {
    background-color: #667eea;
    border-color: #667eea;
    color: white;
}

.pagination .page-item.active .page-link {
    background-color: #667eea;
    border-color: #667eea;
}

/* 모달 스타일 */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 20px 25px;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 15px 25px;
}

.modal-detail-item {
    margin-bottom: 15px;
}

.modal-detail-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.modal-detail-value {
    color: #212529;
}

/* 콘텐츠 리스트 */
.content-list {
    margin-top: 0;
}

.content-header {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 0px;
    font-weight: 600;
    color: #374151;
    font-size: 0.8rem;
}

.content-row {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
    min-height: 42px;
}

/* 읽음 상태 스타일 */
.content-row.is-read {
    opacity: 0.6;
    background-color: #f8f9fa;
}

.content-row.is-read .content-title a {
    color: #9ca3af;
    text-decoration: line-through;
}

.content-row.is-read:hover {
    background-color: #f1f3f4;
}

/* 이미지가 있는 콘텐츠 행 */
.content-row.has-image {
    min-height: 70px;
    align-items: center;
}

.content-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    margin-right: 15px;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.content-info {
    display: flex;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.content-row.has-image .content-title {
    flex: 1;
    min-width: 0;
    padding-right: 20px;
}

.content-row.has-image .content-author {
    width: 120px;
    padding-right: 20px;
    color: #6b7280;
    font-size: 0.8rem;
    padding-top: 2px;
    flex-shrink: 0;
}

.content-row.has-image .content-date {
    width: 100px;
    text-align: right;
    color: #6b7280;
    font-size: 0.8rem;
    padding-top: 2px;
    flex-shrink: 0;
}

.content-row:hover {
    background-color: #f9fafb;
}

.content-row:last-child {
    border-bottom: none;
}

.header-title,
.content-title {
    flex: 1;
    min-width: 0;
    padding-right: 20px;
}

/* 작성자가 없는 경우 제목 영역 확장 */
.content-row.no-author .content-title {
    padding-right: 20px;
}

.content-title a {
    color: #111827;
    text-decoration: none;
    font-weight: 500;
    display: block;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    overflow-wrap: break-word;
    font-size: 0.9rem;
}

.content-title a:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.header-author,
.content-author {
    width: 120px;
    padding-right: 20px;
    color: #6b7280;
    font-size: 0.8rem;
    padding-top: 2px;
    flex-shrink: 0;
}

.header-date,
.content-date {
    width: 100px;
    text-align: right;
    color: #6b7280;
    font-size: 0.8rem;
    padding-top: 2px;
    flex-shrink: 0;
}

/* 다운로드 칼럼 스타일: 날짜 왼쪽에 고정 너비로 표시 */
.header-download,
.content-download {
    width: 40px;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
    padding-top: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

/* flex item order 설정: 제목(1) - 작성자(2) - 다운로드(3) - 등록일(4) */
.content-title { order: 1; }
.header-author, .content-author { order: 2; }
.header-download, .content-download { order: 3; }
.header-date, .content-date { order: 4; }

/* 다운로드 버튼 스타일 보정 (아이콘만 있는 작은 버튼) */
.content-download .download-btn {
    width: 34px;
    height: 34px;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

/* 댓글 수 스타일 */
.comment-count {
    color: #9ca3af;
    font-size: 0.7rem;
    font-weight: 400;
    margin-left: 8px;
}

/* Description 스타일 */
.content-description {
    color: #6b7280;
    font-size: 0.75rem;
    line-height: 1.4;
    margin-top: 4px;
    max-height: 3.6em; /* 약 3줄 */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
}

/* 작성자가 없는 경우의 레이아웃 */
.content-header.no-author,
.content-row.no-author {
    grid-template-columns: 1fr auto;
}

.content-header.has-author,
.content-row.has-author {
    grid-template-columns: 1fr auto auto;
}



/* 빈 상태 및 에러 메시지 */
.empty-message,
.error-message {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 1rem;
}

.error-message {
    color: #dc2626;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .software-wrapper {
        margin: 0 -15px;
        border-radius: 0;
        box-shadow: none;
    }

    .tab-menu {
        padding: 0 15px;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tab-menu::-webkit-scrollbar {
        display: none;
    }

    .tab-button {
        flex-shrink: 0;
        padding: 12px 16px;
        font-size: 0.875rem;
    }

    .content-wrapper {
        padding: 20px 15px;
    }

    .content-header {
        display: none;
    }

    .content-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 16px 0;
    }

    /* 모바일에서 이미지가 있는 경우 */
    .content-row.has-image {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
        min-height: 70px;
    }

    .content-row.has-image .content-image {
        width: 50px;
        height: 50px;
        margin-right: 0;
    }

    .content-row.has-image .content-info {
        flex-direction: column;
        gap: 6px;
    }

    .content-title,
    .content-author,
    .content-date {
        min-width: auto;
        padding-right: 0;
        text-align: left;
    }

    .content-title a {
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .content-author,
    .content-date {
        font-size: 0.8rem;
    }

    /* 모바일에서 작성자가 없는 경우 */
    .content-row.no-author {
        gap: 8px;
    }

    .content-row.no-author .content-title {
        margin-bottom: 8px;
    }
}

@media (max-width: 576px) {
    .tab-button {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .tab-count {
        font-size: 0.7rem;
        padding: 1px 6px;
        margin-left: 6px;
    }
}

/* 크롤러 버튼 스피너 애니메이션 */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 토스트 메시지 스타일 */
.crawler-toast {
    min-width: 400px;
    max-width: 600px;
}

/* 지속적인 토스트 스타일 */
.crawler-toast.persistent {
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.crawler-toast.persistent .toast-header {
    position: relative;
}

.crawler-toast.persistent .toast-header::after {
    content: '📌';
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    opacity: 0.7;
}

.crawler-toast .toast-body {
    white-space: pre-line;
    word-wrap: break-word;
    font-size: 0.85rem;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
}

.crawler-toast .toast-body::-webkit-scrollbar {
    width: 6px;
}

.crawler-toast .toast-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.crawler-toast .toast-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.crawler-toast .toast-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.crawler-toast .toast-header {
    font-weight: 600;
}

.crawler-toast .toast-header .bi {
    font-size: 1.1rem;
}

/* 토스트 애니메이션 개선 */
.toast.showing {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

/* 모바일에서 토스트 크기 조정 */
@media (max-width: 576px) {
    .crawler-toast {
        min-width: 300px;
        max-width: 350px;
    }

    .crawler-toast .toast-body {
        font-size: 0.8rem;
        max-height: 250px;
    }

    .toast-container {
        padding: 0.5rem !important;
    }
}
/* 크롤러 버튼 그룹 스타일 (deduplicated; keep final applied rules) */
.crawler-btn-group {
    display: inline-flex;
    position: relative;
}

.crawler-btn-group .crawler-btn-left,
.crawler-btn-group .crawler-btn-right {
    position: relative;
    z-index: 1;
}

.crawler-btn-group .crawler-btn-left {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.crawler-btn-group .crawler-btn-right {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    margin-left: 0 !important; /* avoid overlapping borders */
    border-left: none !important; /* make sure right button doesn't draw its own left border */
}

/* Hide divider on hover */
.crawler-btn-group .crawler-btn-left:hover::after,
.crawler-btn-group .crawler-btn-right:hover + .crawler-btn-left::after {
    display: none;
}

/* Hover/focus z-index */
.crawler-btn-group .crawler-btn-left:hover,
.crawler-btn-group .crawler-btn-left:focus,
.crawler-btn-group .crawler-btn-left:active,
.crawler-btn-group .crawler-btn-right:hover,
.crawler-btn-group .crawler-btn-right:focus,
.crawler-btn-group .crawler-btn-right:active {
    z-index: 2;
}