/* Header Section */
header {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 12px;
    color: #1a202c;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    color: #718096;
}

/* Filter and Search Section */
.controls-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.search-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.filter-select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.sort-buttons {
    display: flex;
    gap: 8px;
}

.sort-btn {
    padding: 12px 20px;
    background: #eef2ff;
    color: #4338ca;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    background: #667eea;
    color: white;
}

.sort-btn.active {
    background: #667eea;
    color: white;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.stat-number {
    font-size: 2em;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
}

.stat-label {
    color: #718096;
    font-size: 0.9em;
}

/* Problems List */
.problems-section {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h2 {
    font-size: 1.8em;
    color: #1a202c;
    font-weight: 600;
}

.problems-grid {
    display: grid;
    gap: 16px;
}

.problem-card {
    background: #f7fafc;
    border-left: 4px solid #667eea;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.problem-card:hover {
    background: #edf2f7;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.problem-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.problem-title {
    flex: 1;
    min-width: 200px;
}

.problem-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.problem-link {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s ease;
}

.problem-link:hover {
    color: #4338ca;
    text-decoration: underline;
}

.external-icon {
    font-size: 0.8em;
    opacity: 0.7;
}

.problem-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.source-badge.personal {
    background: #d1fae5;
    color: #065f46;
}

.source-badge.contest {
    background: #fef3c7;
    color: #92400e;
}

.contest-link {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.contest-link:hover {
    opacity: 0.7;
}

.date-badge {
    padding: 6px 12px;
    background: #e2e8f0;
    color: #4a5568;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.no-results-icon {
    font-size: 4em;
    margin-bottom: 16px;
}

.no-results-text {
    font-size: 1.2em;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.loading-spinner {
    font-size: 3em;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }

    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input,
    .filter-select {
        width: 100%;
    }

    .sort-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .problem-header {
        flex-direction: column;
    }

    .problem-meta {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header {
        padding: 24px 16px;
    }

    .problems-section {
        padding: 20px;
    }
}