/* Định dạng chung cho toàn bộ trang */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    text-align: center;
    background: #f4f4f4 url('images/background.jpg') center/cover fixed;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: -1;
}

header {
    background: #007bff;
    color: white;
    padding: 10px;
}

/* Khu vực sơ đồ lớp */
#class-map {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 20px;
    position: relative;
    height: 90vh; /* Chiếm 90% chiều cao màn hình */
    z-index: 1;
}

.to {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 2px solid white;
    padding: 7px;
    color: white;
    text-align: center;
    height: 23vh; /* Mỗi tổ chiếm 45% chiều cao màn hình */
    width: 23vw; /* Mỗi tổ chiếm 45% chiều rộng màn hình */
}

.ban {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    background: lightgray;
}

/* Ghế ngồi */
.seat {
    width: 160px;
    height: 80px;
    background: rgba(255, 255, 255, 0.3); /* Làm mờ ghế để thấy background */
    border: 2px solid blue;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: 0.3s ease;
    color: black;
    font-weight: bold;
    border-radius: 10px;
    backdrop-filter: blur(5px); /* Làm mờ ghế */
}

.seat:hover {
    transform: scale(1.1);
    background: #007bff;
    color: white;
    box-shadow: 0 0 10px rgba(243, 1, 158, 0.8);
    backdrop-filter: none;
}

.seat.active {
    background: white !important; /* Hiện rõ khi click vào */
    color: black !important;
    font-size: 22px;
    backdrop-filter: none;
}

/* Khu vực thư viện ảnh */
#gallery button {
    padding: 10px;
    margin: 5px;
    background: #007bff;
    color: white;
    border: none;
    cursor: pointer;
}

#gallery button:hover {
    background: #0056b3;
}

/* Ẩn bảng thông tin ban đầu */
.hidden {
    display: none;
}

/* Hiệu ứng hiển thị bảng thông tin */
#student-info {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, opacity 0.3s;
    opacity: 0;
    z-index: 9; /* Đảm bảo bảng thông tin hiển thị trên cùng */
    width: 350px;
}

#student-info.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.info-box {
    background: white;
    padding: 25px;
    border-radius: 15px;
    width: 100%;
    text-align: center;
    position: relative;
}

#close-btn {
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    position: absolute;
    top: 5px;
    right: 10px;
}

#info-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: 15px;
}

#class-header {
    background: blue;
    color: white;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    padding: 20px 0;
    width: 100%; /* Đảm bảo dải chữ trải dài toàn bộ chiều rộng */
    white-space: nowrap; /* Ngăn chữ bị xuống dòng */
}

.table {
    display: flex;
    justify-content: center;
    gap: 5px;
}
.classroom-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); 
    gap: 10px;
    justify-content: center;
}
/* Điều chỉnh cho điện thoại */
@media (max-width: 768px) {
    #class-header {
        font-size: 6vw; /* Tự động điều chỉnh kích thước theo chiều rộng màn hình */
        padding: 30px 0; /* Tăng khoảng cách trên dưới để dễ đọc */
    }
    #class-map {
        grid-template-columns: repeat(1, 1fr); /* Mỗi hàng chỉ có 1 tổ trên điện thoại */
        height: auto;
    }
    
    .to {
        width: 90vw;
        height: auto;
    }

    .seat {
        width: 60px;
        height: 30px;
        font-size: 12px;
    }
}