:root {
    --primary-color: #3BA196;
    --primary-color-hover: #2E8B80;
    --header-bg: #333;
    --font-family: 'Courier New', Courier, monospace;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    margin: 0;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: var(--header-bg);
    color: white;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#logo {
    max-width: 400px;
    margin-bottom: 1rem;
}

#search-bar {
    width: 60%;
    padding: 0.75rem 1rem;
    font-family: var(--font-family);
    border-radius: 8px;
    border: none;
    outline: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s;
}

#search-bar:focus {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#search-bar::placeholder {
    font-family: var(--font-family);
}

#filter-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: background-color 0.3s;
}

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

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 5px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.filter-dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content label {
    display: block;
    padding: 5px;
    color: #333;
    white-space: nowrap;
}

.dropdown-content label:hover {
    background-color: #f1f1f1;
}

main {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#description-container {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 80%;
    max-width: 1200px;
    margin-bottom: 2rem;
}

#course-container {
    width: 100%;
    max-width: 1200px;
}

.category-section {
    margin-bottom: 2rem;
}

.category-section h2 {
    border-bottom: 2px solid #333;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

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

footer {
    background-color: var(--header-bg);
    color: white;
    text-align: center;
    padding: 1rem;
}

#download-calendar {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: background-color 0.3s;
}

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

.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.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-registration-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 1rem;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: background-color 0.3s;
}

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

.calendar-actions {
    margin: 1rem 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.calendar-button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: background-color 0.3s;
}

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

#loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    #logo {
        width: 90%;
        max-width: none;
    }
    #search-bar {
        width: 90%;
    }
    #description-container {
        width: 95%;
    }
    .modal-content {
        width: 90%;
        margin: 5% auto;
    }
}

@media (max-width: 480px) {
    .course-grid {
        grid-template-columns: 1fr;
    }
    main {
        padding: 1rem;
    }
    #description-container {
        padding: 1rem;
    }
}
