/* أنماط الفهرس الموحد */
.catalog-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2c5aa0 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.catalog-hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.catalog-hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.stat {
    text-align: center;
}

.stat .number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat .label {
    font-size: 1rem;
    opacity: 0.8;
}

/* أنماط البحث */
.catalog-search {
    background: var(--light-color);
    padding: 2rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-box input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1rem;
}

.search-box button {
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
}

.quick-filters {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #ddd;
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* البحث المتقدم */
.advanced-search-toggle {
    text-align: center;
    margin: 1.5rem 0;
}

.advanced-search {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 1rem;
    display: none;
}

.advanced-search.show {
    display: block;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* نتائج البحث */
.catalog-results {
    padding: 2rem 0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--light-color);
    border-radius: 8px;
}

.results-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.results-sort select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.results-view button {
    padding: 0.5rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

.results-view button.active {
    background: var(--primary-color);
    color: white;
}

/* عناصر النتائج */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    gap: 1.5rem;
    border-right: 4px solid var(--primary-color);
}

.result-item.grid-item {
    flex-direction: column;
}

.item-type {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 100px;
}

.item-type i {
    font-size: 2rem;
    color: var(--primary-color);
}

.item-content {
    flex: 1;
}

.item-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.item-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.item-meta span {
    background: var(--light-color);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.9rem;
}

.item-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.item-library {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.item-subjects {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.subject-tag {
    background: #e3f2fd;
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
}

.item-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

/* التصفح */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.page-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

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

/* التحميل والرسائل */
.loading {
    text-align: center;
    padding: 3rem;
    display: none;
}

.loading-spinner {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.no-results {
    text-align: center;
    padding: 3rem;
    display: none;
}

.no-results-icon {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.suggestions {
    margin-top: 2rem;
    text-align: right;
}

.suggestions ul {
    list-style: none;
    padding: 0;
}

.suggestions li {
    padding: 0.5rem 0;
    color: #666;
}

/* النافذة المنبثقة */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    background: white;
    margin: 2rem auto;
    width: 90%;
    max-width: 800px;
    border-radius: 8px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 1.5rem;
}

/* تفاصيل العنصر */
.item-details .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.detail-type {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
}

.detail-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stars {
    color: #ffc107;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

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

.detail-item strong {
    color: #666;
    font-size: 0.9rem;
}

.availability.available {
    color: var(--success-color);
}

.availability.unavailable {
    color: var(--danger-color);
}

.subjects-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detail-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e0e0e0;
}

/* التجاوب */
@media (max-width: 768px) {
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .result-item {
        flex-direction: column;
    }
    
    .item-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .detail-actions {
        flex-direction: column;
    }
}