/* Calendar Container */
.wec-calendar-container {
    max-width: 100%;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    background: #fff;
    border: 1px solid #ddd;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
}

/* Header */
.wec-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.wec-month-label {
    margin: 0;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.wec-nav-btn {
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap;
}

.wec-nav-btn:hover {
    background: #e0e0e0;
}

/* Grid Layout */
.wec-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid #eee;
    border-left: 1px solid #eee;
}

/* Headers (Days of week) */
.wec-day-header {
    padding: 10px;
    background: #f9f9f9;
    font-weight: bold;
    text-align: center;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* Day Cells */
.wec-day-cell {
    min-height: 100px;
    padding: 5px;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    background: #fff;
    vertical-align: top;
    position: relative;
    display: flex;
    flex-direction: column;
}

.wec-day-cell.empty {
    background: #fcfcfc;
}

/* Today highlight */
.wec-day-cell.today {
    background-color: #fff9c4;
}

.wec-date-number {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
    color: #555;
    text-align: right;
    padding-right: 5px;
}

/* Event Items */
.wec-event-item {
    display: block;
    margin-bottom: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    transition: opacity 0.2s;
}

a.wec-event-item:hover {
    opacity: 0.9;
    filter: brightness(1.1);
    color: #fff;
}

span.wec-event-item {
    cursor: default;
}

/* Loading Overlay */
.wec-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* RWD for Mobile */
@media screen and (max-width: 768px) {

    /* ✅ 強制手機版：上一月/下一月左右排列（不允許上下） */
    .wec-calendar-container .wec-calendar-header{
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }

    /* 中間月份標題縮小，避免擠爆 */
    .wec-calendar-container .wec-month-label {
        font-size: 1.1em !important;
        flex: 1 !important;
        text-align: center !important;
        margin: 0 !important;
    }

    /* 左右按鈕縮小字體 + padding */
    .wec-calendar-container .wec-nav-btn {
        font-size: 12px !important;
        padding: 6px 8px !important;
        max-width: 40% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .wec-day-header {
        font-size: 0.8em;
        padding: 5px 2px;
    }

    .wec-day-cell {
        min-height: 80px;
        padding: 2px;
    }

    .wec-date-number {
        font-size: 12px;
    }

    .wec-event-item {
        font-size: 11px;
        padding: 3px 4px;
    }
}
