/* FILE: /calendar/calendar-widget.css */
/* ใช้ Prefix 'cw-' (Calendar Widget) เพื่อป้องกันการทับซ้อน */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;700&display=swap');

.cw-wrapper {
    font-family: 'Sarabun', sans-serif;
    display: flex;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 800px;
    margin: auto;
}

/* --- ส่วนปฏิทิน (ซ้าย) --- */
.cw-calendar-container {
    flex: 1;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    background-color: #007bff;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
}
.cw-header h3 {
    margin: 0 !important;
    font-size: 1.1rem;
    font-weight: 500;
    color: white !important;
}
.cw-nav-arrow {
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: transform 0.2s;
    color: white!important;
}
.cw-nav-arrow:hover {
    transform: scale(1.2);
}

.cw-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}
.cw-table th {
    color: #dc3545 !important; /* สีแดงสำหรับวันอาทิตย์ */
    text-align: center !important;
    background-color: #eee !important;
    padding-bottom: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}
.cw-table td {
    padding: 5px;
    font-size: 0.95rem;
}

.cw-day-cell {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    border: 1px solid transparent;

    /* --- เพิ่ม 3 บรรทัดนี้เพื่อจัดกึ่งกลาง --- */
    display: flex;
    align-items: center;
    justify-content: center;
}
.cw-day-cell.cw-other-month {
    color: #ccc;
    cursor: default;
}
.cw-day-cell:not(.cw-other-month):hover {
    background-color: #e9ecef;
}
.cw-day-cell.cw-today {
    background-color: #007bff;
    color: white;
    font-weight: bold;
}
.cw-day-cell.cw-has-event {
    background-color: #ffd200; /* สีเหลืองสำหรับวันที่มีกิจกรรม */
    color: #333;
    font-weight: bold;
}
.cw-day-cell.cw-selected {
    /* border-color: #0056b3;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);*/
}


/* --- ส่วนรายละเอียด (ขวา) --- */
.cw-details-container {
    flex: 1;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.cw-details-header {
    font-weight: bold;
    font-size: 1rem;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.cw-details-content {
    min-height: 200px;
    /* --- START: เพิ่มโค้ดสำหรับ Scrollbar --- */
    max-height: 280px;  /* กำหนดความสูงสูงสุด (ปรับค่าได้ตามความสวยงาม) */
    overflow-y: auto;   /* แสดง Scrollbar แนวตั้งเมื่อเนื้อหาเกิน */
    padding-right: 10px;/* เพิ่มช่องว่างด้านขวาเล็กน้อยไม่ให้ Scrollbar ชิดเนื้อหา */
    /* --- END: เพิ่มโค้ดสำหรับ Scrollbar --- */
}
.cw-event-item {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.cw-event-item:last-child {
    border-bottom: none;
}
.cw-event-title {
    font-weight: 300;
    color: #000;
    font-size: 0.9rem;
}
.cw-event-description {
    font-size: 0.8rem;
    color: #555;
    margin: 5px 0 !important;
}
/* ใช้ ID มานำหน้าเพื่อเพิ่มความเจาะจงให้สูงสุด */
#activity-calendar-container .cw-event-links a {
    display: inline-flex; /* ใช้ flex เพื่อให้ไอคอนกับข้อความอยู่ตรงกลางสวยงาม */
    align-items: center;
    gap: 5px; /* เพิ่มระยะห่างระหว่างไอคอนกับข้อความ */
    margin-right: 10px;
    font-size: 0.8rem !important; /* กำหนดขนาดฟอนท์ที่ต้องการ และใส่ !important เพื่อสู้กลับ */
    color: #00a00f !important;
    text-decoration: none !important;
    font-weight: normal !important; /* เพิ่มเผื่อไว้กรณี template ทำให้เป็นตัวหนา */
}
#activity-calendar-container .cw-event-links a:hover {
    color: #ffd200 !important;
}
#activity-calendar-container .cw-event-links a:visited {
    color: #00a00f !important;
}
/* --- START: Modal Styles --- */
.cw-modal {
    display: none; /* ซ่อนไว้เป็นค่าเริ่มต้น */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
}

.cw-modal-content {
    position: relative;
    background-color: #fefefe;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.cw-modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    color: white;
    background-color: #dc3545;
    font-size: 28px;
    font-weight: bold;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    border-radius: 50%;
    cursor: pointer;
}

#cw-modal-body {
    flex-grow: 1;
    overflow: hidden;
}

#cw-modal-body img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#cw-modal-body iframe {
    width: 100%;
    height: calc(90vh - 60px); /* ปรับความสูงให้พอดี */
    border: none;
}
/* --- END: Modal Styles --- */