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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    color: #1e3a8a;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.search-form {
    background: white;
    padding: clamp(20px, 4vw, 30px);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: clamp(20px, 4vw, 30px);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: clamp(15px, 3vw, 20px);
    align-items: start;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: clamp(14px, 2vw, 16px);
    display: block;
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: clamp(14px, 2.5vw, 16px);
    transition: border-color 0.3s;
    min-height: 44px;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1e3a8a;
}

.building-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-btn {
    background-color: #1e3a8a;
    color: white;
    padding: clamp(10px, 2vw, 12px) clamp(18px, 3vw, 24px);
    border: none;
    border-radius: 5px;
    font-size: clamp(14px, 2.5vw, 16px);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    height: fit-content;
    margin-top: 10px;
    min-height: 44px;
}

.search-btn:hover {
    background-color: #1e40af;
}

.loading {
    text-align: center;
    font-size: clamp(16px, 2.5vw, 18px);
    color: #666;
    padding: clamp(15px, 3vw, 20px);
}

.results {
    background: white;
    padding: clamp(20px, 4vw, 30px);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.results h2 {
    color: #1e3a8a;
    margin-bottom: 20px;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
}

.room-list {
    display: grid;
    gap: 15px;
}

.room-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
}

.room-item:hover {
    border-color: #1e3a8a;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.1);
}

.room-item.clickable {
    cursor: pointer;
}

.room-item.clickable:hover {
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
    transform: translateY(-2px);
}

.room-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 10px;
}

.room-name {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 600;
    color: #1e3a8a;
    margin: 0;
}

.availability-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.available {
    background-color: #dcfce7;
    color: #166534;
}

.occupied {
    background-color: #fecaca;
    color: #991b1b;
}

.room-details {
    color: #666;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    margin-top: 8px;
    line-height: 1.5;
}

.building-info {
    background: #e0f2fe;
    border-left: 4px solid #0284c7;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 0 5px 5px 0;
}

.no-results {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: clamp(20px, 5vw, 40px);
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.6;
}

.error-message {
    background-color: #fecaca;
    color: #991b1b;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border: 1px solid #f87171;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #1e3a8a;
    font-size: clamp(1.2rem, 3vw, 1.4rem);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.weekly-schedule {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.day-column {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    min-height: 180px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.day-column.selected-date {
    border: 2px solid #1e3a8a;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
    transform: scale(1.02);
}

.day-header {
    background: #eff6ff;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 16px;
}

.day-header.selected-date-header {
    background: #1e3a8a;
    color: white;
}

.day-header.selected-date-header .day-name,
.day-header.selected-date-header .day-date {
    color: white;
}

.day-name {
    display: block;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 4px;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.day-date {
    color: #475569;
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
}

.day-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.day-empty {
    text-align: center;
    color: #94a3b8;
    font-style: italic;
}

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.schedule-item {
    padding: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.schedule-time {
    font-weight: 600;
    color: #1e3a8a;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    margin-bottom: 5px;
}

.schedule-title {
    font-size: clamp(0.9rem, 2vw, 1rem);
    color: #333;
    margin-bottom: 5px;
}

.schedule-instructor {
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    color: #666;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .search-form {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 15px;
    }

    header {
        padding: 20px;
        margin-bottom: 25px;
    }

    .results {
        padding: 20px;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-body {
        padding: 15px;
    }

    .weekly-schedule {
        grid-template-columns: 1fr;
        gap: 15px;
        overflow-x: visible;
    }

    .day-column.selected-date {
        transform: none;
    }

    .day-body {
        padding: 14px;
    }

    .room-item {
        padding: 15px;
    }

    .form-group input,
    .form-group select {
        padding: 14px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .search-form {
        padding: 15px;
        gap: 12px;
    }

    header {
        padding: 15px;
        margin-bottom: 20px;
    }

    .results {
        padding: 15px;
    }

    .room-item {
        padding: 12px;
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group select {
        padding: 12px;
        font-size: 16px;
    }

    .search-btn {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 48px;
    }

    .modal-content {
        width: 98%;
        max-height: 95vh;
        margin: 1vh auto;
    }

    .modal-header,
    .modal-body {
        padding: 12px;
    }

    .room-name {
        font-size: 1rem;
    }

    .room-details {
        font-size: 0.9em;
    }

    .availability-status {
        padding: 3px 8px;
        font-size: 0.8em;
    }

    .day-header {
        padding: 10px 12px;
    }

    .day-body {
        padding: 10px;
    }

    .schedule-item {
        padding: 12px;
    }

    .schedule-time {
        font-size: 1em;
    }

    .schedule-title {
        font-size: 0.9em;
    }

    .schedule-instructor {
        font-size: 0.85em;
    }
}