/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

header p a {
    color: white;
    text-decoration: underline;
    text-underline-offset: 2px;
}

header p a:hover {
    opacity: 0.9;
}

/* Main layout */
main {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    gap: 2rem;
}

/* Filters sidebar */
.filters {
    flex: 0 0 280px;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.filters h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #667eea;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #555;
}

.filter-group input[type="text"],
.filter-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.filter-group input[type="text"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

#clear-filters {
    width: 100%;
    padding: 0.75rem;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#clear-filters:hover {
    background-color: #5568d3;
}

/* Content area */
.content {
    flex: 1;
    min-width: 0;
}

.loading {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: #666;
}

.loading.error {
    color: #d32f2f;
}

.no-results {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: #666;
}

/* World grid */
.world-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* World card */
.world-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.world-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.world-thumbnail-wrap {
    cursor: pointer;
    display: block;
}

.world-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    background-color: #eee;
}

.world-info {
    padding: 1rem;
}

.world-name {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #333;
    word-break: break-word;
}

.world-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-seed {
    background-color: #e3f2fd;
    color: #1976d2;
}

.badge-evil {
    background-color: #fce4ec;
    color: #c2185b;
}

.badge-size {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.badge-difficulty {
    background-color: #fff3e0;
    color: #e65100;
}

.download-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background-color: #667eea;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.download-btn:hover {
    background-color: #5568d3;
}

/* Responsive design */
@media (max-width: 768px) {
    main {
        flex-direction: column;
        padding: 1rem;
    }

    .filters {
        position: static;
        flex: 1;
    }

    header h1 {
        font-size: 2rem;
    }

    .world-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

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

/* Thumbnail modal */
.thumbnail-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.thumbnail-modal.thumbnail-modal-visible {
    display: flex;
}

.thumbnail-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    cursor: pointer;
}

.thumbnail-modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
}

.thumbnail-modal-img {
    display: block;
    max-width: 100%;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.thumbnail-modal-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    width: 2rem;
    height: 2rem;
    padding: 0;
    font-size: 1.75rem;
    line-height: 1;
    color: white;
    background: transparent;
    border: none;
    cursor: pointer;
}

.thumbnail-modal-close:hover {
    opacity: 0.8;
}

.load-more-sentinel {
    height: 1px;
}
