/* Header Styles */
.library-header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.library-header-main h3 {
    margin: 0;
    color: #2e7d32;
    display: flex;
    align-items: center;
    gap: 10px;
}

.library-header-main .muted {
    font-size: 0.85rem;
    color: #78909c;
    margin: 5px 0 0 0;
}

/* Header Actions Layout */
.library-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Search Bar */
.library-search-wrap {
    position: relative;
    background: #fff;
    border-radius: 25px;
    padding: 5px 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 200px;
}

.search-icon {
    color: #90a4ae;
    margin-right: 8px;
}

.premium-input {
    border: none;
    background: none;
    padding: 8px 5px;
    font-weight: 500;
    color: #37474f;
    outline: none;
    width: 100%;
}

/* Child Selector */
.library-selector-wrap {
    position: relative;
    background: #fff;
    border-radius: 25px;
    padding: 5px 15px;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.1);
    display: flex;
    align-items: center;
    border: 1px solid rgba(46, 125, 50, 0.2);
}

.selector-icon {
    color: #2e7d32;
    margin-right: 8px;
}

.premium-select {
    border: none;
    background: none;
    padding: 8px 5px;
    font-weight: 600;
    color: #37474f;
    outline: none;
    cursor: pointer;
    min-width: 150px;
}

/* Tabs System */
.library-tabs {
    display: flex;
    position: relative;
    background: rgba(46, 125, 50, 0.05);
    border-radius: 15px;
    padding: 5px;
    margin-bottom: 20px;
}

.lib-tab {
    flex: 1;
    border: none;
    background: none;
    padding: 12px;
    font-weight: 600;
    color: #546e7a;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: color 0.3s ease;
    font-size: 0.9rem;
}

.lib-tab.active {
    color: #fff;
}

.lib-tab-indicator {
    position: absolute;
    height: calc(100% - 10px);
    width: calc(50% - 5px);
    background: #2e7d32;
    border-radius: 12px;
    top: 5px;
    left: 5px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.library-tabs .lib-tab[data-lib-tab="history"].active ~ .lib-tab-indicator {
    transform: translateX(100%);
}

.lib-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

/* Tab Panels */
.lib-panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

.lib-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Enhanced Library Cards */
.library-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) {
    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

.library-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.05);
    border-left: 6px solid #cfd8dc;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.library-card:hover {
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.1);
}

.library-card.status-active { border-left-color: #4caf50; }
.library-card.status-due-soon { border-left-color: #ffa000; }
.library-card.status-overdue { border-left-color: #e53935; }

/* Collapsed Header */
.card-header-main {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.book-info h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #263238;
}

.book-info .student-tag {
    font-size: 0.75rem;
    color: #78909c;
    display: block;
    margin-top: 4px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-chip {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.status-active .status-chip { background: rgba(76, 175, 80, 0.1); color: #4caf50; }
.status-due-soon .status-chip { background: rgba(255, 160, 0, 0.1); color: #ffa000; }
.status-overdue .status-chip { background: rgba(229, 57, 53, 0.1); color: #e53935; }

.expand-icon {
    color: #b0bec5;
    transition: transform 0.3s ease;
}

.library-card.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Expanded Content */
.card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fafafa;
    border-radius: 0 0 16px 16px;
}

.library-card.expanded .card-details {
    max-height: 300px; /* Large enough to fit content */
}

.details-content {
    padding: 0 20px 20px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    border-top: 1px solid rgba(0,0,0,0.03);
    padding-top: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #90a4ae;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.detail-item span {
    font-size: 0.85rem;
    color: #455a64;
    font-weight: 600;
}

.history-card {
    border-left-width: 4px;
    opacity: 0.85;
}

.loading-placeholder {
    padding: 40px;
    text-align: center;
    color: #90a4ae;
}

.empty-library {
    padding: 60px 20px;
    text-align: center;
    background: rgba(255,255,255,0.5);
    border-radius: 20px;
    border: 2px dashed #eceff1;
}

.empty-library i {
    font-size: 3rem;
    color: #cfd8dc;
    margin-bottom: 15px;
}

.empty-library p {
    color: #90a4ae;
    font-weight: 500;
}
