/* =========================================
   LIBRARY PAGE STYLES (SIMPLIFIED CONCEPT)
   ========================================= */
.library-header { background-color: var(--bg-white); padding: 130px 20px 40px; border-bottom: 1px solid #e5e7eb; }
.library-header h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 10px; }
.library-header p { color: var(--text-muted); margin-bottom: 30px; }

/* --- CLEAN SEARCH CONTAINER --- */
.search-container {
    max-width: 600px; /* Limits width so it doesn't stretch too far */
    margin: 30px auto 0;
}

/* 1. TABS STYLE */
.tabs-wrapper {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    background: #f8fafc;
    padding: 5px;
    border-radius: 50px;
    border: 1px solid #e2e8f0;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.tab-btn {
    padding: 10px 24px;
    background: transparent;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.tab-btn:hover { color: var(--text-main); }

/* Active Tab (Blue Pill) */
.tab-btn.active {
    background-color: white;
    color: var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* 2. SEARCH INPUT STYLE */
.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input-wrapper input {
    width: 100%;
    padding: 16px 16px 16px 50px; /* Left padding for icon */
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    outline: none;
    transition: 0.2s;
    background: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.search-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.5;
}

/* --- Materials Grid --- */
.library-content { padding: 40px 20px 80px; }
.results-count { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 20px; font-weight: 600; text-transform: uppercase; display: block; }
.materials-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 25px; }

/* --- CARD DESIGN (RECTANGULAR) --- */
.material-card {
    background: white;
    border-radius: 8px; 
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.material-card:hover { transform: translateY(-3px); box-shadow: 0 8px 15px rgba(0, 0, 0, 0.08); border-color: var(--primary); }

.card-header { display: flex; gap: 16px; align-items: flex-start; }
.file-icon-box {
    width: 50px; height: 50px; background-color: var(--primary); 
    border-radius: 6px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; color: white; 
}
.file-icon-box svg { width: 26px; height: 26px; }

.header-info h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-main); margin-bottom: 4px; line-height: 1.2; }
.meta-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.course-code { font-size: 0.85rem; color: var(--primary); font-weight: 700; }

.card-body p { font-size: 0.9rem; color: #4b5563; line-height: 1.5; border-top: 1px solid #f3f4f6; padding-top: 12px; margin-bottom: 2px; }
.visible-meta { font-size: 0.8rem; color: var(--text-main); font-weight: 600; margin-bottom: 5px; }

.btn-download-full {
    width: 100%; background-color: var(--primary); color: white; font-weight: 600;
    padding: 10px; border-radius: 6px; border: none; cursor: pointer; 
    display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.95rem; transition: background 0.2s; margin-top: auto;
}
.btn-download-full:hover { background-color: var(--primary-dark); }

/* --- Mobile Fixes --- */
@media (max-width: 768px) {
    .library-header { padding-top: 100px; }
    .tabs-wrapper { width: 100%; } /* Tabs take full width */
    .tab-btn { flex: 1; text-align: center; } /* Even split */
    .materials-grid { grid-template-columns: 1fr; }
}
