/* ==================================================================== */
/* 🗓️ 案内THAI - Centralized Calendar Styling (Fixed & Secured)        */
/* ==================================================================== */

/* Reset ป้องกัน CSS หน้าหลักรั่วเข้ามาสืบทอดขนาด */
.cal-card-box, 
.cal-card-box * {
    box-sizing: border-box;
}

/* การ์ดครอบปฏิทินแบบสีขาวมน */
.cal-card-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid #f1f5f9;
    max-width: 650px;
    margin: 0 auto;
    width: 100%; /* รองรับจอ Mobile ไม่ให้ล้น */
}

.cal-header-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 20px;
}

/* ส่วนหัว Navigation สลับเดือน */
.cal-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cal-title-date {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0056b3;
}

.cal-btn-prev, .cal-btn-next {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0056b3;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cal-btn-prev:hover:not(:disabled), 
.cal-btn-next:hover:not(:disabled) {
    background-color: #f0f7ff;
    border-color: #0056b3;
}

.cal-btn-prev:disabled, 
.cal-btn-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ตารางแสดงผลปฏิทิน Grid (ล็อก 7 คอลัมน์เท่ากันเสมอ) */
.calendar-days-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 8px;
    text-align: center;
}

/* หัววันอาทิตย์ - เสาร์ */
.day-header {
    padding: 8px 0;
    font-weight: bold;
    font-size: 0.9rem;
    color: #475569;
    background-color: #f8fafc;
    border-radius: 6px;
}

/* ล็อกสีวันอาทิตย์ (ชิ้นที่ 1) และวันเสาร์ (ชิ้นที่ 7) ของเฉพาะ day-header เท่านั้น */
.calendar-days-grid > .day-header:nth-of-type(1) { color: #dc2626; background-color: #fef2f2; }
.calendar-days-grid > .day-header:nth-of-type(7) { color: #0284c7; background-color: #f0f9ff; }

/* ช่องวันที่ (Day Cells) */
.day-cell {
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 2px;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    user-select: none;
}

/* ช่องว่างต้นเดือน (Blank Cells) */
.day-cell.blank {
    background: transparent;
    border: none;
    cursor: default;
}

/* ข้อความตัวเลขวันที่ */
.day-cell .day-num {
    line-height: 1.2;
}

/* ข้อความสถานะด้านล่างตัวเลข (เช่น 終了, 今日, 満車) */
.day-cell .status-text {
    font-size: 0.70rem;
    font-weight: normal;
    margin-top: 2px;
    color: #94a3b8;
    line-height: 1;
}

/* โหมดวันที่ผ่านไปแล้ว (จบช่วงเวลา) */
.day-cell.past {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* โหมดรถเต็ม (満車) */
.day-cell.disabled {
    background-color: #fef2f2;
    color: #94a3b8;
    cursor: not-allowed;
}

/* โหมดวันที่ปัจจุบัน (今日) */
.day-cell.today {
    border-color: #0288d1;
    background-color: #e0f2fe;
}

/* โหมดเมื่อวางเมาส์เหนือวันที่เลือกได้ */
.day-cell:not(.past):not(.disabled):not(.blank):hover {
    background-color: #e0f2fe;
    border-color: #0284c7;
    color: #0369a1;
}

/* โหมดวันที่ถูกคลิกเลือก (Selected) */
.day-cell.selected {
    background-color: #0056b3 !important;
    color: #ffffff !important;
    border-color: #0056b3 !important;
}

.day-cell.selected .status-text {
    color: #ffffff !important;
}