<!-- start Simple Custom CSS and JS -->
<style type="text/css">
/* Общие стили */
.directions-filter-system {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Блок управления */
.filter-controls {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.search-container {
    margin-bottom: 20px;
}

.direction-search {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #dee2e6;
    border-radius: 30px;
    font-size: 16px;
    transition: all 0.3s;
}

.direction-search:focus {
    border-color: #3b71ca;
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 113, 202, 0.2);
}

.subject-filters, .sorting-options {
    margin-bottom: 20px;
}

.subject-filters h4, .sorting-options h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #343a40;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    padding: 10px 20px;
    background: #d44822;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.filter-btn.active, .filter-btn:hover {
    background: #3b71ca;
    color: white;
}

.sorting-options select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
}

.results-counter {
    font-size: 16px;
    font-weight: 500;
    padding: 12px 0;
    border-top: 1px solid #dee2e6;
    margin-top: 20px;
}

/* Сетка карточек */
.directions-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

/* Карточка направления */
.direction-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.direction-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}

.card-header {
    padding: 20px 20px 15px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: flex-start;
}

.card-header h3 {
    margin: 0;
    flex-grow: 1;
    font-size: 1.3em;
    color: #1a1a1a;
}

.direction-thumbnail {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.direction-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.85em;
    color: #6c757d;
    margin-bottom: 3px;
}

.meta-value {
    font-weight: 500;
    color: #212529;
}

.card-content {
    padding: 20px;
    flex-grow: 1;
    line-height: 1.6;
    color: #444;
    font-size: 15px;
}

.card-subjects {
    padding: 0 20px 20px;
}

.subjects-label {
    display: block;
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 10px;
}

.subject-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.subject-tag {
    background: #e0f7fa;
    color: #006064;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
}

.direction-link {
    display: block;
    text-align: center;
    padding: 14px;
    background: #3b71ca;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s;
    margin-top: auto;
}

.direction-link:hover {
    background: #3061b4;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #6c757d;
}

/* Адаптивность */
@media (max-width: 768px) {
    .directions-container {
        grid-template-columns: 1fr;
    }
    
    .filter-buttons {
        flex-direction: column;
    }
    
    .filter-btn {
        width: 100%;
    }
}</style>
<!-- end Simple Custom CSS and JS -->
