
/* Tab bar */
.lib-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #f0e0dc;
    margin-bottom: 2rem;
}
.lib-tab {
    padding: 1rem 1.75rem;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    color: #6b5c5c;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
.lib-tab:hover { color: #7b1113; }
.lib-tab.active { color: #7b1113; border-bottom-color: #7b1113; }
.lib-tab i { color: #c4893a; font-size: 1rem; }

@media (max-width: 768px) {
    .lib-tabs {
        flex-direction: column;
        border-bottom: none;
        gap: 0.5rem;
    }
    .lib-tab {
        border-bottom: 1px solid #f0e0dc;
        border-radius: 8px;
        padding: 0.85rem 1.25rem;
    }
    .lib-tab.active {
        background: #fffaf9;
        border-left: 3px solid #7b1113;
        border-bottom-color: #f0e0dc;
    }
}

/* Section panels */
.lib-panel { display: none; }
.lib-panel.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #f0e8e8;
}
.filter-bar label { font-size:0.8rem; font-weight:600; color:#2d0507; white-space:nowrap; }
.filter-bar select, .filter-bar input {
    padding: 0.5rem 0.85rem;
    border: 1px solid #e8c8c8;
    border-radius: 8px;
    font-size: 0.86rem;
    font-family: inherit;
    background: #faf8f5;
}
.filter-bar select:focus, .filter-group select:focus, .filter-bar input:focus { outline:none; border-color:#7b1113; }

.filter-group {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
.filter-group select {
    min-width: 80px;
}

/* Year group & semester group */
.year-group { margin-bottom: 2.5rem; }
.year-heading {
    font-size: 1.25rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: #2d0507;
    border-left: 4px solid #c4893a;
    padding: 0.3rem 0 0.3rem 0.85rem;
    margin-bottom: 1rem;
}
.sem-group { margin-bottom: 1.25rem; padding-left: 1.25rem; border-left: 1px dashed #e8c8c8; margin-left: 0.3rem; }
.sem-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #6b5c5c; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.4rem; }
.sem-label i { color: #c4893a; }

.subject-heading {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2d0507;
    margin: 1.5rem 0 1rem;
    display: flex;
    align-items: center;
}

/* Resource items */
.res-item {
    background: white;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    border: 1px solid #f0e8e8;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}
.res-item:hover { transform: translateX(5px); border-color: #c4893a; box-shadow: 0 4px 12px rgba(45,5,7,0.05); }
.res-icon { width:42px; height:42px; border-radius:8px; display:flex; align-items:center; justify-content:center; flex-shrink:0; font-size:1.1rem; }
.res-icon.pyq { background: #fee2e2; color: #b91c1c; }
.res-icon.paper { background: #fef3c7; color: #92400e; }
.res-icon.book { background: #f0fdf4; color: #166534; }

.res-body { flex:1; }
.res-title { font-size:0.92rem; font-weight:700; color:#2d0507; margin-bottom:0.25rem; line-height:1.4; }
.res-meta { font-size:0.75rem; color:#6b5c5c; display:flex; align-items:flex-start; flex-wrap: wrap; gap: 0.5rem 1rem; line-height:1.4; }
.meta-block { display: inline-flex; align-items: flex-start; word-break: break-word; }
.meta-block i { flex-shrink: 0; margin-top: 0.15rem; }
.res-link { font-size:0.8rem; font-weight:700; color:#7b1113; padding:0.4rem 0.85rem; border-radius:6px; border:1.5px solid #e8c8c8; transition:all 0.15s; white-space:nowrap; }
.res-link:hover { background:#7b1113; color:white; border-color:#7b1113; }

.empty-state { text-align: center; padding: 4rem 2rem; color: #6b5c5c; }
.empty-state i { font-size: 3rem; color: #e8c8c8; margin-bottom: 1rem; }

/* Mobile refinements for resource items (Ultra-Density) */
@media (max-width: 500px) {
    .res-item {
        flex-wrap: wrap; 
        align-items: flex-start;
        gap: 0.5rem 0.85rem;
        padding: 1rem;
    }
    
    .res-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .res-body {
        flex: 1;
        min-width: 0; /* Critical for title wrapping next to icon */
    }
    
    .res-title {
        font-size: 0.88rem;
        margin-bottom: 0.25rem;
    }
    
    .res-meta {
        font-size: 0.72rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .res-meta span {
        margin-left: 0 !important;
    }
    
    .res-link {
        width: 100%;
        text-align: center;
        padding: 0.6rem;
        font-size: 0.85rem;
        margin-top: 0.5rem;
        background: #faf8f5;
    }
}
