:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    margin-bottom: 2rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.search-section {
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-wrapper {
    margin-bottom: 1rem;
    max-width: 700px;
    position: relative;
    width: 100%;
}

#course-search {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    /* Added right padding for the button */
    border: 2px solid var(--border-color);
    border-radius: 9999px;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm);
}

#course-search:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.clear-btn:hover {
    color: var(--text-main);
    background-color: rgba(0, 0, 0, 0.05);
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
}

.courses-section h2,
.results-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.courses-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 60vh;
    /* Use viewport height unit for better responsiveness */
    min-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
    /* Space for scrollbar */
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    background-color: #fff;
}

.course-item {
    background: var(--card-bg);
    padding: 0.35rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.course-item:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.course-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.course-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.course-name {
    font-size: 1rem;
    color: var(--text-main);
    flex: 1;
}

.sticky-results {
    position: sticky;
    top: 2rem;
}

.results-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.stats-card {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.results-block {
    margin-bottom: 2rem;
}

.results-block h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.status-list {
    list-style: none;
}

.status-list li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-list li.completed-area {
    background-color: var(--success-bg);
    color: var(--success-text);
    font-weight: 500;
}

.status-list li.valid-combination {
    background-color: #e0e7ff;
    color: #3730a3;
    font-weight: 500;
    border: 1px solid #c7d2fe;
}

.empty-state {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 1rem !important;
    background: transparent !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}