:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --light-bg: #ecf0f1;
    --card-bg: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #bdc3c7;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    max-width: 1600px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Filters Sidebar */
.filters {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.claude-skill-btn {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.claude-skill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.filters h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.filter-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-section h3 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.filter-section label {
    display: block;
    margin-bottom: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.filter-section input[type="checkbox"] {
    margin-right: 0.5rem;
}

.filter-section select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

#searchInput {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.filter-actions {
    margin-top: 1rem;
}

#resetFilters {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--text-light);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

#resetFilters:hover {
    background-color: var(--primary-color);
}

.stats {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.stats span {
    font-weight: 600;
    color: var(--secondary-color);
}

/* Mechanics Grid */
.mechanics-grid {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.sort-controls label {
    margin-right: 0.5rem;
    font-weight: 600;
}

.sort-controls select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background-color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.view-toggle button:first-child {
    border-radius: 4px 0 0 4px;
}

.view-toggle button:last-child {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.view-toggle button.active {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.view-toggle button:hover:not(.active) {
    background-color: var(--light-bg);
}

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* List Layout */
.list-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Mechanic Card */
.mechanic-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.mechanic-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--secondary-color);
}

.mechanic-card.hidden {
    display: none;
}

.mechanic-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.mechanic-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.difficulty-easy {
    background-color: #d4edda;
    color: #155724;
}

.badge.difficulty-moderate {
    background-color: #fff3cd;
    color: #856404;
}

.badge.difficulty-challenging {
    background-color: #f8d7da;
    color: #721c24;
}

.badge.algebra-high {
    background-color: #d1ecf1;
    color: #0c5460;
}

.badge.algebra-medium {
    background-color: #e7e7f1;
    color: #383d75;
}

.badge.algebra-low {
    background-color: #f0f0f0;
    color: #6c757d;
}

.badge.demo-available {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.mechanic-description {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mechanic-subjects {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.mechanic-subjects strong {
    color: var(--text-dark);
}

/* List view specific styles */
.list-layout .mechanic-card {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    align-items: start;
}

.list-layout .mechanic-card h3 {
    font-size: 1.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: var(--text-light);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--accent-color);
}

#modalBody h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 2rem;
}

#modalBody .modal-section {
    margin-bottom: 1.5rem;
}

#modalBody .modal-section h3 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

#modalBody .modal-section p,
#modalBody .modal-section ul {
    color: var(--text-dark);
    line-height: 1.8;
}

#modalBody ul {
    margin-left: 1.5rem;
}

#modalBody ul li {
    margin-bottom: 0.5rem;
}

.demo-placeholder {
    background: var(--light-bg);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
    margin-top: 1rem;
}

.demo-placeholder.has-demo {
    border-color: var(--success-color);
    background: #f0f9f4;
}

.demo-button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.demo-button:hover {
    background-color: var(--primary-color);
}

.download-skill-btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.download-skill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Responsive Design */
@media (max-width: 1024px) {
    main {
        grid-template-columns: 250px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }

    .filters {
        position: relative;
        top: 0;
    }

    .grid-layout {
        grid-template-columns: 1fr;
    }

    .list-layout .mechanic-card {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2rem;
    }

    .modal-content {
        width: 95%;
        margin: 2% auto;
        padding: 1.5rem;
    }
}
