/* schedule_style.css */
body {
    background-image: url('pic/pic\ bg\ 3.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center center;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.schedule-container {
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 100%;
    max-width: 960px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px auto;
    box-sizing: border-box;
}

.schedule-title {
    font-size: 2.2em;
    font-weight: 600;
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
}

.schedule-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #ccc;
    width: 100%;
}

.tab-button {
    background-color: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 20px;
    transition: background-color 0.3s, color 0.3s;
    font-size: 1.2em;
    font-weight: 600;
    color: #7f8c8d;
}

.tab-button:hover {
    background-color: #e9ecef;
}

.tab-button.active {
    background-color: #2c3e50;
    color: white;
    border-radius: 5px 5px 0 0;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 16px;
    table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
    padding: 15px;
    border: 1px solid #ddd;
    text-align: left;
    word-wrap: break-word;
}

.schedule-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    white-space: nowrap;
}

.schedule-table th:nth-child(1),
.schedule-table td:nth-child(1) {
    width: 15%;
    white-space: nowrap;
}

.schedule-table th:nth-child(2),
.schedule-table td:nth-child(2) {
    width: 40%;
}

.schedule-table td:nth-child(3) img {
    width: 100px;
    height: 100px;
    display: block;
    margin: 0 auto;
    object-fit: cover;
    border-radius: 10px;
}
.schedule-table th:nth-child(3),
.schedule-table td:nth-child(3) {
    width: 15%;
    text-align: center;
}

.schedule-table th:nth-child(4),
.schedule-table td:nth-child(4) {
    width: 30%;
}

.home-button {
    background-color: white;
    color: darkcyan;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
    margin-left: 1rem;
}

.home-button:hover {
    background-color: #f0f0f0;
    color: darkcyan;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.header-right-side {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-direction: row-reverse;
    padding-right: 15px;
}

/* เพิ่มสีหัวข้อตารางสำหรับแต่ละวัน */
.schedule-table.day-mon thead th {
    background-color: #F5E1A4;
    color: black;
}
.schedule-table.day-tue thead th {
    background-color: #ffd1ff;
    color: black;
}
.schedule-table.day-wed thead th {
    background-color: #06cd6a;
    color: black;
}
.schedule-table.day-thu thead th {
    background-color: #f59a38ea;
    color: black;
}
.schedule-table.day-fri thead th {
    background-color: #91d4f6;
    color: black;
}
.schedule-table.day-sat thead th {
    background-color: #cf77f2;
    color: black;
}
.schedule-table.day-sun thead th {
    background-color: #b51232;
    color: black;
}


/* --- Responsive Table (Card Layout) for Mobile --- */
@media (max-width: 768px) {
    .schedule-tabs {
        flex-wrap: wrap;
    }

    .tab-button {
        font-size: 1em;
        padding: 10px 15px;
        margin-bottom: 5px;
    }

    .header {
        position: static;
        padding-top: 20px;
    }
    
    .header-right-side {
        justify-content: center;
        width: 100%;
        padding-right: 0;
    }
    
    .home-button {
        margin-left: 0;
    }

    .schedule-table {
        border: 0;
        display: block;
        width: 100%;
        table-layout: auto;
    }

    .schedule-table thead {
        display: none;
    }

    .schedule-table tbody {
        display: block;
    }

    .schedule-table tr {
        margin-bottom: 20px;
        border: 1px solid #ddd;
        border-radius: 8px;
        background-color: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        padding: 10px;
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .schedule-table td {
        border: none;
        position: relative;
        padding: 5px 10px;
        font-size: 14px;
        word-wrap: break-word;
        padding-left: 10px;
    }

    .schedule-table td:first-of-type {
        border-bottom: 1px solid #ddd;
        padding-bottom: 5px;
        margin-bottom: 5px;
        font-size: 13px;
        padding-left: 10px;
        white-space: nowrap;
    }
    
    .schedule-table td:nth-child(2),
    .schedule-table td:nth-child(4) {
        text-align: left;
        white-space: normal;
        padding-top: 20px; /* เพิ่มช่องว่างด้านบน */
    }

    .schedule-table td:first-of-type::before {
        display: none;
    }

    .schedule-table td::before {
        content: attr(data-label);
        position: static;
        display: block;
        margin-bottom: 5px;
        font-weight: bold;
        color: #555;
        text-align: left;
        white-space: nowrap;
    }
    
    .schedule-table td:nth-child(3) {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        text-align: right;
    }

    .schedule-table td:nth-child(3)::before {
        content: attr(data-label);
        position: static;
        display: block;
        margin-bottom: 5px;
        width: auto;
        text-align: right;
    }

    .schedule-table td img {
        max-width: 100px;
        height: auto;
        display: block;
        margin: 10px 0 10px auto;
        object-fit: contain;
        border-radius: 10px;
    }
}