/* 컨텐츠 관리 시스템 스타일 */

/* 기본 스타일 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    line-height: 1.6;
}

/* 로그인 페이지 */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.login-page .card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.login-page .card-body {
    padding: 3rem;
}

/* 네비게이션 */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

/* 카드 스타일 */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
}

/* 통계 카드 */
.card.bg-primary,
.card.bg-success,
.card.bg-warning,
.card.bg-info {
    border: none;
    color: white;
}

.card.bg-primary:hover,
.card.bg-success:hover,
.card.bg-warning:hover,
.card.bg-info:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

/* 버튼 스타일 */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

/* 미디어 카드 액션 압축 */
.media-actions-primary {
    display: inline-flex;
    gap: 2px;
    flex-wrap: wrap;
}
.media-actions-more .dropdown-menu {
    min-width: 220px;
}

/* 미디어 카드 버튼 2열 배치 */
.card-footer .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
}
.card-footer .btn-group .btn {
    flex: 1 1 calc(50% - 4px);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(45deg, #007bff, #0056b3);
}

.btn-success {
    background: linear-gradient(45deg, #28a745, #1e7e34);
}

.btn-warning {
    background: linear-gradient(45deg, #ffc107, #e0a800);
}

.btn-danger {
    background: linear-gradient(45deg, #dc3545, #c82333);
}

.btn-info {
    background: linear-gradient(45deg, #17a2b8, #138496);
}

/* 폼 스타일 */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 테이블 스타일 */
.table {
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.table tbody tr {
    transition: background-color 0.3s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* 배지 스타일 */
.badge {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

/* 알림 스타일 */
.alert {
    border: none;
    border-radius: 10px;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: #28a745;
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    border-left-color: #dc3545;
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    border-left-color: #ffc107;
    background-color: #fff3cd;
    color: #856404;
}

.alert-info {
    border-left-color: #17a2b8;
    background-color: #d1ecf1;
    color: #0c5460;
}

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

.modal-header {
    border-bottom: 1px solid #e9ecef;
    border-radius: 15px 15px 0 0;
}

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

/* 페이지네이션 */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
    color: #007bff;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
}

/* 드롭다운 */
.dropdown-menu {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* 네비게이션 드롭다운이 페이지 요소 위로 올라오도록 보정 */
.navbar .dropdown-menu {
    z-index: 2000;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

/* 미디어 카드 그리드 레이아웃 - 강제 다열 배치 */
.mediaGrid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 1rem !important;
}

/* CSS Grid를 사용한 반응형 레이아웃 */
.row.media-row {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap: 1rem !important;
    margin: 0 !important;
    width: 100% !important;
}

.row.media-row > .media-col {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.5rem !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* 반응형 컬럼 수 조정 - 화면 크기에 따라 자동 조정 */
/* 모바일 (최대 575px) */
@media (max-width: 575.98px) {
    .row.media-row {
        grid-template-columns: repeat(2, 1fr) !important; /* 2열 */
        gap: 0.75rem !important;
    }
}

/* 작은 태블릿 (576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .row.media-row {
        grid-template-columns: repeat(3, 1fr) !important; /* 3열 */
        gap: 0.75rem !important;
    }
}

/* 태블릿 (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .row.media-row {
        grid-template-columns: repeat(4, 1fr) !important; /* 4열 */
    }
}

/* 큰 태블릿 (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .row.media-row {
        grid-template-columns: repeat(5, 1fr) !important; /* 5열 */
    }
}

/* 데스크탑 (1200px 이상) */
@media (min-width: 1200px) {
    .row.media-row {
        grid-template-columns: repeat(6, 1fr) !important; /* 6열 */
    }
}

/* 매우 큰 화면 (1400px 이상) */
@media (min-width: 1400px) {
    .row.media-row {
        grid-template-columns: repeat(7, 1fr) !important; /* 7열 */
    }
}

/* force-inline 클래스 제거 - 더 이상 필요하지 않음 */
.row.media-row.force-inline {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
}

.row.media-row.force-inline > .media-col {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0.5rem !important;
}

/* 미디어 카드 최소 크기 조정 */
.media-col .card {
    min-height: 200px;
}

.media-col .card-img-top {
    min-height: 120px;
}

/* 파일 이름 클릭 스타일 */
.file-details-link {
    color: #007bff !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-details-link:hover {
    color: #0056b3 !important;
    text-decoration: underline !important;
    transform: translateY(-1px);
}

.file-details-link:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}

/* 컨텐츠 테이블 모바일 최적화 */
.content-table {
    position: relative;
}

.content-table .sticky-col {
    position: sticky;
    left: 0;
    background-color: white;
    z-index: 10;
    min-width: 120px;
}

.content-table .sticky-col:nth-child(1) {
    left: 0;
    min-width: 200px;
}

.content-table .sticky-col:nth-child(2) {
    left: 200px;
    min-width: 100px;
}

.content-table .sticky-col:nth-child(3) {
    left: 300px;
    min-width: 80px;
}

.content-table .scrollable-col {
    min-width: 100px;
    white-space: nowrap;
}

/* 컨텐츠 제목 링크 스타일 */
.content-title-link {
    color: #007bff !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.content-title-link:hover {
    color: #0056b3 !important;
    text-decoration: underline !important;
}

.content-title-link:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}

/* 작은 화면에서 카드 크기 조정 */
@media (max-width: 575.98px) {
    .media-col .card {
        min-height: 180px;
    }
    
    .media-col .card-img-top {
        min-height: 100px;
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container-fluid {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    /* 모바일에서 컨텐츠 테이블 최적화 */
    .content-table .sticky-col:nth-child(1) {
        left: 0;
        min-width: 150px;
    }
    
    .content-table .sticky-col:nth-child(2) {
        left: 150px;
        min-width: 80px;
    }
    
    .content-table .sticky-col:nth-child(3) {
        left: 230px;
        min-width: 70px;
    }
    
    .content-table .scrollable-col {
        min-width: 80px;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .form-control,
    .form-select {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 로딩 스피너 */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* 커스텀 스크롤바 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 텍스트 에디터 스타일 */
.tox-tinymce {
    border-radius: 8px !important;
    border: 1px solid #e9ecef !important;
}

.tox-tinymce:focus-within {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* 상태별 색상 */
.status-draft {
    color: #6c757d;
}

.status-pending {
    color: #ffc107;
}

.status-published {
    color: #28a745;
}

.status-archived {
    color: #343a40;
}

/* 아이콘 스타일 */
.fas, .far, .fab {
    margin-right: 0.5rem;
}

/* 유틸리티 클래스 */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e9ecef;
    }
    
    .card {
        background-color: #2d2d2d;
        color: #e9ecef;
    }
    
    .card-header {
        background-color: #2d2d2d;
        border-bottom-color: #495057;
    }
    
    .table {
        color: #e9ecef;
    }
    
    .table thead th {
        background-color: #343a40;
        color: #e9ecef;
    }
    
    .form-control,
    .form-select {
        background-color: #2d2d2d;
        border-color: #495057;
        color: #e9ecef;
    }
    
    .form-control:focus,
    .form-select:focus {
        background-color: #2d2d2d;
        border-color: #007bff;
        color: #e9ecef;
    }
}

/* 컨텐츠 필터 폼 스타일 - 모바일 최적화 */
.content-filter-form {
    width: 100%;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

.filter-item.filter-actions {
    flex: 0 0 auto;
    gap: 0.5rem;
}

.filter-label {
    margin: 0;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    flex-shrink: 0;
}

.filter-item .form-control,
.filter-item .form-select {
    flex: 1 1 auto;
    min-width: 0;
}

/* 모바일에서 필터 항목을 한 줄에 표시 */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .filter-item {
        width: 100%;
        flex-direction: row;
        align-items: center;
    }
    
    .filter-label {
        width: 80px;
        flex-shrink: 0;
        font-size: 0.875rem;
        text-align: left;
    }
    
    .filter-item .form-control,
    .filter-item .form-select {
        flex: 1 1 auto;
        min-width: 0;
    }
    
    .filter-item.filter-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
    
    .filter-item.filter-actions .btn {
        flex: 1 1 auto;
        min-width: 0;
    }
    
    .btn-text {
        display: inline;
    }
}

/* 작은 모바일 화면 (576px 이하) */
@media (max-width: 576px) {
    .filter-label {
        width: 70px;
        font-size: 0.8rem;
    }
    
    .filter-item .form-control,
    .filter-item .form-select {
        font-size: 0.875rem;
    }
    
    .filter-item.filter-actions .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .btn-text {
        display: inline;
    }
}

/* 데스크탑 화면 */
@media (min-width: 769px) {
    .filter-item {
        flex: 0 1 auto;
    }
    
    .filter-item.filter-actions {
        flex: 0 0 auto;
    }
    
    .filter-label {
        width: auto;
        min-width: 60px;
    }
}

/* 모바일 검색 폼 최적화 */
@media (max-width: 768px) {
    /* 검색 폼 컴팩트하게 */
    .card-body .row.g-2 {
        margin: 0;
    }
    
    .card-body .form-label.small {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    .card-body .form-select-sm,
    .card-body .form-control-sm {
        font-size: 0.875rem;
        padding: 0.375rem 0.5rem;
    }
    
    .card-body .btn-sm {
        padding: 0.375rem 0.75rem;
    }
}

/* 인쇄 스타일 */
@media print {
    .navbar,
    .btn,
    .modal,
    .alert {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    body {
        background-color: white;
        color: black;
    }
}
