:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #f5f6fa;
    --text-color: #2c3e50;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Header and Navigation */
header {
    background-color: var(--primary-color);
    padding: 1rem;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
}

.tab {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: white;
    cursor: pointer;
}

.tab.active {
    border-bottom: 2px solid var(--secondary-color);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* Calendar Styles */
.calendar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

#calendar {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Search Section Styles */
.search-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    background: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Calendar Event Styles */
.hour-slot {
    display: grid;
    grid-template-columns: 80px 1fr;
    border-bottom: 1px solid #eee;
    min-height: 60px;
}

.hour-label {
    padding: 0.5rem;
    background: #f8f9fa;
    border-right: 1px solid #eee;
}

.hour-events {
    padding: 0.5rem;
}

.event-item {
    background: var(--secondary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delete-event {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.event-item:hover .delete-event {
    opacity: 1;
}

.week-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #eee;
}

.week-day {
    background: white;
    padding: 0.5rem;
    min-height: 120px;
}

.week-day-header {
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

/* Movie Card Styles */
#searchResults {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

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

.movie-card:hover {
    transform: translateY(-4px);
}

.movie-card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.movie-card h3 {
    padding: 0.75rem;
    font-size: 1rem;
}

.movie-card p {
    padding: 0 0.75rem 0.75rem;
    font-size: 0.875rem;
    color: #666;
}

/* Watchlist Button */
.movie-card .watchlist-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.movie-card:hover .watchlist-btn {
    opacity: 1;
}

/* Loading State */
.loading {
    position: relative;
    min-height: 200px;
}

.loading::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-color);
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--background-color);
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    margin: 2rem auto;
    animation: spin 1s linear infinite;
}

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

.error-message {
    text-align: center;
    padding: 2rem;
    background: #fee;
    border-radius: 8px;
    margin: 1rem 0;
}

.error-message button {
    margin-top: 1rem;
}

/* Disabled Button State */
button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Button Styles */
button {
    padding: 0.5rem 1rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background: #2980b9;
}

#addEventBtn {
    margin-top: 1rem;
}

/* Calendar Control Buttons */
.calendar-controls button {
    background: var(--primary-color);
    padding: 0.25rem 0.75rem;
}

.calendar-controls button:hover {
    background: #34495e;
}

/* API Error Page */
.api-error {
    max-width: 600px;
    margin: 4rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.api-error h1 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.api-error ol {
    margin-left: 1.5rem;
}

.api-error a {
    color: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-controls {
        grid-template-columns: 1fr;
    }
}
