/* MicroSim Faceted Search Styles */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    padding: 20px;
    background: #f5f5f5;
    color: #333;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

/* Search Box */
.search-container {
    grid-column: 1 / -1;
    margin-bottom: 10px;
}

#search-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

#search-input:focus {
    border-color: #3498db;
}

/* Sidebar Facets */
.sidebar {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.facet {
    margin-bottom: 25px;
}

.facet:last-child {
    margin-bottom: 0;
}

.facet h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    text-transform: uppercase;
    color: #7f8c8d;
    letter-spacing: 0.5px;
}

.facet-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    cursor: pointer;
    transition: color 0.2s;
}

.facet-item:hover {
    color: #3498db;
}

.facet-item input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.facet-item label {
    flex: 1;
    cursor: pointer;
    font-size: 14px;
}

.facet-item .count {
    background: #ecf0f1;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: #7f8c8d;
}

.facet-item.selected label {
    font-weight: 600;
    color: #3498db;
}

.clear-filters {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    font-size: 14px;
    margin-top: 15px;
    transition: background 0.2s;
}

.clear-filters:hover {
    background: #c0392b;
}

/* Results Area */
.results-container {
    min-height: 500px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-count {
    font-size: 16px;
    color: #7f8c8d;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Result Cards */
.result-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.result-card h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.result-card h3 a {
    color: #2c3e50;
    text-decoration: none;
}

.result-card h3 a:hover {
    color: #3498db;
}

.result-card .description {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.result-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.tag {
    background: #e8f4fd;
    color: #3498db;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 12px;
}

.tag.level {
    background: #e8f8f5;
    color: #1abc9c;
}

.tag.bloom {
    background: #fef5e7;
    color: #f39c12;
}

.tag.library {
    background: #f4ecf7;
    color: #9b59b6;
}

.tag.difficulty {
    background: #fdecea;
    color: #e74c3c;
}

.result-card .meta {
    font-size: 12px;
    color: #95a5a6;
}

/* Active Filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.active-filter {
    background: #3498db;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.active-filter .remove {
    cursor: pointer;
    font-weight: bold;
}

/* No results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.no-results h2 {
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }
}

/* Help Modal */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.help-modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.help-modal h2 {
    margin-top: 0;
    color: #2c3e50;
}

.help-modal h3 {
    color: #3498db;
    margin-top: 20px;
    margin-bottom: 10px;
}

.help-modal table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.help-modal th, .help-modal td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.help-modal th {
    background: #f8f9fa;
    font-weight: 600;
}

.help-modal code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.help-modal .example {
    background: #e8f4fd;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
}

.help-modal .close-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 15px;
}

.help-modal .close-btn:hover {
    background: #2980b9;
}

/* Help link in header */
.help-link {
    font-size: 14px;
    color: #3498db;
    text-decoration: none;
    vertical-align: middle;
}

.help-link:hover {
    text-decoration: underline;
}
