/* Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #2C3E50;
    --secondary-color: #34495E;
    --accent-color: #3498DB;
    --light-gray: #ECF0F1;
    --text-dark: #2C3E50;
    --text-light: #7F8C8D;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #F8F9FA;
    line-height: 1.6;
    color: var(--text-dark);
}

.navbar {
    background-color: var(--primary-color) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: white !important;
}

.main-container {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Dashboard Card Styles */
.dashboard-card {
    background: #fff;
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.dashboard-card .card-header {
    background-color: #fff;
    border-bottom: 2px solid #f0f0f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-card .card-header i {
    color: var(--accent-color);
    margin-right: 0.5rem;
}

.dashboard-card .card-body {
    padding: 0;
}

/* List Group Styles for Recent Items */
.list-group-item {
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-group-item:first-child {
    border-top: none;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item a {
    color: #555;
    text-decoration: none;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.list-group-item a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.item-date {
    font-size: 0.8rem;
    color: #999;
    min-width: 60px;
    text-align: right;
}

.btn-more {
    font-size: 0.8rem;
    color: #999;
    text-decoration: none;
}

.btn-more:hover {
    color: var(--accent-color);
}

footer {
    background-color: #fff;
    border-top: 1px solid #eee;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-links a {
    color: #666;
    text-decoration: none;
    margin: 0 10px;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--accent-color);
}

.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline .card {
    position: relative;
    margin-left: 30px;
    border-left: 3px solid #3498db;
    border-radius: 0;
}

.timeline .card:before {
    content: '';
    position: absolute;
    left: -10px;
    top: 20px;
    width: 17px;
    height: 17px;
    background: #3498db;
    border-radius: 50%;
}

.timeline .card-title {
    color: #3498db;
    font-weight: 700;
    margin-bottom: 1rem;
}

.timeline .card-text {
    color: #666;
}

/* Ticker Styles */
.ticker-container {
    overflow: hidden;
    white-space: nowrap;
}

.ticker-wrapper {
    display: inline-block;
    animation: ticker-slide 40s linear infinite;
    will-change: transform;
}

.ticker-item {
    display: inline-block;
    margin-right: 2rem;
    color: var(--text-dark);
    text-decoration: none;
}

.ticker-item:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.ticker-wrapper:hover {
    animation-play-state: paused;
}

@keyframes ticker-slide {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* 1. Table List View -> Card View Transformation */
    .table-responsive table, 
    .table-responsive thead, 
    .table-responsive tbody, 
    .table-responsive th, 
    .table-responsive td, 
    .table-responsive tr { 
        display: block; 
    }

    /* Hide Table Header */
    .table-responsive thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Style Rows as Cards */
    .table-responsive tbody tr { 
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        margin-bottom: 1rem;
        background-color: #fff;
        padding: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    /* Style Cells */
    .table-responsive td { 
        border: none;
        border-bottom: none; 
        position: relative;
        padding: 0.2rem 0;
        text-align: left !important; /* Force left align */
    }

    /* Specific Column Styling (Based on standard order: No, Access, Title, Author, Date, Views) */
    
    /* No (Index) - Show it */
    .table-responsive td:nth-child(1) {
        display: block;
        font-size: 0.8rem;
        color: #999;
        margin-bottom: 0.2rem;
    }
    .table-responsive td:nth-child(1)::before { content: "No. "; }

    /* Access Level Badge */
    .table-responsive td:nth-child(2) {
        margin-bottom: 0.5rem;
    }

    /* Title - Make it look like a header */
    .table-responsive td:nth-child(3) {
        font-size: 1.1rem;
        font-weight: bold;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* Author, Date, Views - Display block (Vertical) */
    .table-responsive td:nth-child(4),
    .table-responsive td:nth-child(5),
    .table-responsive td:nth-child(6) {
        display: block;
        font-size: 0.9rem;
        color: #666;
        margin-bottom: 0.2rem;
        width: 100%;
    }

    /* Add labels for clarity */
    .table-responsive td:nth-child(4)::before { content: "작성자: "; font-weight: 500; display: inline-block; width: 60px; }
    .table-responsive td:nth-child(5)::before { content: "등록일: "; font-weight: 500; display: inline-block; width: 60px; }
    .table-responsive td:nth-child(6)::before { content: "조회: "; font-weight: 500; display: inline-block; width: 60px; }


    /* 2. View Page Improvements */
    
    /* Header Title and Badge stacking */
    .dashboard-card .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dashboard-card .card-header h4 {
        margin-bottom: 0.5rem !important;
        font-size: 1.25rem;
        line-height: 1.4;
    }

    /* Meta Info Row (Author | Date | Views) */
    .card-body .row.text-muted {
        display: flex;
        flex-direction: column;
    }
    
    .card-body .row.text-muted .col-md-6 {
        width: 100%;
        text-align: left !important;
        margin-bottom: 0.25rem;
    }

    /* Fix for Content Box Overlap on Mobile */
    .content-box {
        height: auto !important;
        min-height: 100px !important;
        overflow: visible !important;
        margin-bottom: 2rem !important;
    }
    
    /* File Download Section Stacking */
    .card-body .d-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .card-body .d-flex > div {
        margin-bottom: 1rem;
        width: 100%;
    }
    
    .card-body .d-flex .btn {
        width: 100%;
        display: block;
    }
    
    /* Bottom Buttons (List, Edit, Delete) */
    .card-body .border-top .d-flex {
        flex-direction: column;
    }
    
    .card-body .border-top .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .card-body .border-top .btn-group {
        width: 100%;
        display: flex;
    }
    
    .card-body .border-top .btn-group .btn {
        flex: 1;
        margin-bottom: 0;
    }
}