/* ============================================
   Study Materials - Premium Two-Column Layout
   ============================================ */

:root {
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ============================================
   Main Section
   ============================================ */
.materials-section {
    padding: 100px 0 4rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f1f5f9 100%);
    min-height: 100vh;
}

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

/* ============================================
   Top Bar
   ============================================ */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.625rem 1rem;
    box-shadow: var(--glass-shadow);
    transition: all 0.2s ease;
    width: 340px;
    max-width: 100%;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-box i {
    color: var(--text-secondary);
    margin-right: 0.75rem;
}

.search-box input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: transparent;
}

.search-box input::placeholder {
    color: #9ca3af;
}

.search-hint {
    padding: 0.125rem 0.5rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: inherit;
}

/* ============================================
   Breadcrumbs
   ============================================ */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.breadcrumbs .separator {
    color: #cbd5e1;
}

.breadcrumbs .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================
   Semester Tabs
   ============================================ */
.semester-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
}

.semester-tabs::-webkit-scrollbar {
    display: none;
}

.semester-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: var(--glass-shadow);
}

.semester-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.semester-tab.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.semester-tab i {
    font-size: 0.8rem;
}

/* Keyboard Hints */
.keyboard-hints {
    display: none;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    padding-left: 1rem;
}

.kbd-hint {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.kbd-hint kbd {
    padding: 0.125rem 0.375rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.65rem;
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

@media (min-width: 992px) {
    .keyboard-hints {
        display: flex;
    }
}

/* ============================================
   Two Column Grid
   ============================================ */
.study-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* ============================================
   Subject Sidebar
   ============================================ */
.subject-sidebar {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    position: sticky;
    top: 100px;
}

.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-header h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
}

.subject-list {
    max-height: 450px;
    overflow-y: auto;
}

.subject-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.subject-item:hover {
    background: rgba(37, 99, 235, 0.05);
}

.subject-item.active {
    background: rgba(37, 99, 235, 0.08);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.subject-item i {
    font-size: 0.875rem;
    opacity: 0.7;
}

.subject-item span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    min-height: 500px;
}

.content-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(248, 250, 252, 0.5);
}

.content-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* ============================================
   Modules View
   ============================================ */
.modules-view {
    padding: 1.5rem;
}

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

.module-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.25rem;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.module-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
    transform: translateY(-3px);
}

.module-card:hover::before {
    opacity: 1;
}

.module-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.module-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.module-card.is-playlist .module-icon {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.module-card.is-file .module-icon {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.module-icon i {
    font-size: 1.25rem;
}

.module-info {
    flex: 1;
    min-width: 0;
}

.module-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.375rem;
    line-height: 1.3;
}

.module-type {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.module-type::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.module-card.is-playlist .module-type::before {
    background: #ef4444;
}

.module-card.is-file .module-type::before {
    background: #10b981;
}

.module-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.5rem 0 0;
    line-height: 1.4;
}

.module-description-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    color: #0369a1;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.module-description-notice i {
    font-size: 1rem;
    margin-top: 0.15rem;
    color: #0284c7;
    flex-shrink: 0;
}

.module-actions {
    margin-top: 1rem;
}

/* ============================================
   Materials View
   ============================================ */
.materials-view {
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.materials-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.material-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Video Card */
.video-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.video-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
    transform: translateY(-3px);
}

.video-thumbnail-link {
    display: block;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.video-thumbnail {
    position: relative;
    padding-top: 56.25%;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.2s ease;
}

.video-card:hover .play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.play-overlay i {
    font-size: 1.25rem;
    color: #ef4444;
    margin-left: 3px;
}

.video-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.75rem;
}

.video-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    flex: 1;
}

.video-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #fef2f2;
    border: 1px solid #fee2e2;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #ef4444;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-top: auto;
}

.video-action:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.video-action i {
    font-size: 0.8rem;
}

/* File Card */
/* File Card */
.file-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    transition: all 0.25s ease;
    cursor: default;
}

.file-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
    transform: translateY(-2px);
}

.file-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-icon i {
    font-size: 1.25rem;
    color: white;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.file-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.file-action:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.file-action i {
    font-size: 0.8rem;
}

/* ============================================
   Load More
   ============================================ */
.load-more-wrap {
    text-align: center;
    padding: 0.5rem 0 1rem;
}

.btn-load-more {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.btn-load-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-load-more i {
    margin-right: 0.5rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

/* ============================================
   States
   ============================================ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.75rem;
}

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

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3.5rem;
    opacity: 0.2;
    margin-bottom: 1rem;
    display: block;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 992px) {
    .study-grid {
        grid-template-columns: 1fr;
    }

    .subject-sidebar {
        position: static;
    }

    .subject-list {
        display: flex;
        overflow-x: auto;
        max-height: none;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .subject-item {
        padding: 0.5rem 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 50px;
        border-left-width: 1px;
        white-space: nowrap;
    }

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

@media (max-width: 768px) {
    .container-wide {
        padding: 0 1rem;
    }

    .materials-section {
        padding-top: 80px;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-box {
        width: 100%;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .module-grid,
    .materials-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .semester-tabs {
        gap: 0.375rem;
    }

    .semester-tab {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .semester-tab i {
        display: none;
    }

    .file-card {
        flex-direction: column;
        text-align: center;
    }

    .file-name {
        white-space: normal;
    }
}
