/* Library Web Styles */
:root {
    --library-primary: #4F46E5;
    --library-primary-dark: #4338CA;
    --library-secondary: #10B981;
    --library-bg: #F9FAFB;
    --library-card-bg: #FFFFFF;
    --library-text: #1F2937;
    --library-text-light: #6B7280;
    --library-border: #E5E7EB;
    --library-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --library-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Library Page */
.library-page {
    background: var(--library-bg);
    min-height: 100vh;
    padding-bottom: 60px;
}

.library-page .container {
    max-width: 1280px;
    padding: 0 20px;
}

/* Hero Section */
.library-hero {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, var(--library-primary) 0%, var(--library-primary-dark) 100%);
    margin: -20px -20px 40px -20px;
    color: white;
}

.library-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.library-hero .lead {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

/* Search Box */
.search-container {
    max-width: 700px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 6px;
    box-shadow: var(--library-shadow-lg);
}

.search-box .search-icon {
    padding: 0 16px;
    color: var(--library-text-light);
    font-size: 1.125rem;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 12px 0;
    background: transparent;
}

.search-box input::placeholder {
    color: var(--library-text-light);
}

.search-box .search-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    background: var(--library-primary);
    border: none;
}

.search-box .search-btn:hover {
    background: var(--library-primary-dark);
}

/* Filters Section */
.filters-section {
    background: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: var(--library-shadow);
}

.filter-label {
    font-weight: 600;
    color: var(--library-text);
    margin-bottom: 8px;
    display: block;
}

.filters-section .form-control {
    border: 1px solid var(--library-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
}

.filters-section .form-control:focus {
    border-color: var(--library-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Section Titles */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--library-text);
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.results-count {
    color: var(--library-text-light);
    font-size: 0.95rem;
}

/* Categories Grid */
.categories-section {
    margin-bottom: 50px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.category-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--library-shadow);
    border-left: 4px solid var(--library-primary);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--library-shadow-lg);
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.category-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--library-text);
    margin: 0 0 6px 0;
}

.category-info p {
    font-size: 0.875rem;
    color: var(--library-text-light);
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.material-count {
    font-size: 0.8rem;
    color: var(--library-primary);
    font-weight: 600;
}

/* Materials Grid */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.material-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--library-shadow);
}

.material-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--library-shadow-lg);
}

.material-thumbnail {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #F3F4F6;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.material-type-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.material-type-pdf {
    background: #FEE2E2;
    color: #DC2626;
}

.material-type-video,
.material-type-video-url {
    background: #DBEAFE;
    color: #2563EB;
}

.material-type-excel {
    background: #D1FAE5;
    color: #059669;
}

.material-type-word-document {
    background: #DBEAFE;
    color: #1D4ED8;
}

.material-type-powerpoint {
    background: #FFEDD5;
    color: #EA580C;
}

.material-type-image {
    background: #F3E8FF;
    color: #9333EA;
}

.material-type-other {
    background: #F3F4F6;
    color: #4B5563;
}

.material-body {
    padding: 20px;
}

.material-body .material-category {
    font-size: 0.8rem;
    color: var(--library-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.material-body .material-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--library-text);
    margin: 8px 0 10px 0;
    line-height: 1.4;
}

.material-body .material-desc {
    font-size: 0.875rem;
    color: var(--library-text-light);
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.material-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--library-text-light);
    padding-top: 12px;
    border-top: 1px solid var(--library-border);
}

.material-footer i {
    margin-right: 4px;
}

/* Loading & Empty States */
.loading-spinner {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--library-border);
    border-top-color: var(--library-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--library-text-light);
}

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

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--library-text);
}

/* Pagination */
.pagination-container {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 8px;
}

.page-item .page-link {
    display: block;
    padding: 10px 16px;
    border-radius: 8px;
    background: white;
    color: var(--library-text);
    text-decoration: none;
    border: 1px solid var(--library-border);
    transition: all 0.2s ease;
}

.page-item .page-link:hover {
    background: var(--library-bg);
    border-color: var(--library-primary);
}

.page-item.active .page-link {
    background: var(--library-primary);
    color: white;
    border-color: var(--library-primary);
}

.page-item.disabled .page-link {
    opacity: 0.5;
    pointer-events: none;
}

/* Material Detail Page */
.library-material-detail {
    background: var(--library-bg);
    min-height: 100vh;
    padding: 30px 0 60px;
}

.breadcrumb-nav {
    margin-bottom: 24px;
}

.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    list-style: none;
}

.breadcrumb-item {
    font-size: 0.875rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    padding: 0 8px;
    color: var(--library-text-light);
}

.breadcrumb-item a {
    color: var(--library-primary);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--library-text-light);
}

.material-header {
    margin-bottom: 30px;
}

.material-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.material-meta .material-category {
    background: var(--library-bg);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--library-text-light);
}

.material-header .material-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--library-text);
    margin: 0 0 16px 0;
}

.material-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: var(--library-text-light);
    font-size: 0.9rem;
}

.material-info i {
    margin-right: 6px;
}

/* Content Viewer */
.content-viewer {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--library-shadow);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.pdf-viewer {
    height: 600px;
    border-radius: 8px;
    overflow: hidden;
}

.pdf-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.image-viewer img,
.thumbnail-preview img {
    max-width: 100%;
    border-radius: 8px;
}

.download-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--library-border);
}

.btn-download {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
}

.btn-download i {
    margin-right: 8px;
}

/* Description Section */
.description-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--library-shadow);
}

.description-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--library-text);
}

.description-content {
    color: var(--library-text);
    line-height: 1.7;
}

/* Sidebar */
.material-sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--library-shadow);
}

.sidebar-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--library-text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--library-border);
}

.info-item {
    margin-bottom: 12px;
}

.info-item label {
    display: block;
    font-size: 0.8rem;
    color: var(--library-text-light);
    margin-bottom: 4px;
}

.info-item span {
    font-weight: 500;
    color: var(--library-text);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--library-bg);
    color: var(--library-primary);
    border-radius: 20px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tag-badge:hover {
    background: var(--library-primary);
    color: white;
    text-decoration: none;
}

.action-buttons .btn {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 10px 16px;
    border-radius: 8px;
}

.action-buttons .btn:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .library-hero {
        padding: 40px 16px;
    }
    
    .library-hero h1 {
        font-size: 1.75rem;
    }
    
    .search-box {
        flex-direction: column;
        padding: 12px;
    }
    
    .search-box .search-icon {
        display: none;
    }
    
    .search-box input {
        width: 100%;
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .search-box .search-btn {
        width: 100%;
    }
    
    .categories-grid,
    .materials-grid {
        grid-template-columns: 1fr;
    }
    
    .material-header .material-title {
        font-size: 1.5rem;
    }
    
    .material-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .material-sidebar {
        position: static;
        margin-top: 24px;
    }
}
