/* ========================================
   たこやき オリジナル営業カレンダー CSS
======================================== */

#takoyaki-calendar {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    padding: 28px;
    font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
}

/* ========================================
   ヘッダー（年月 + ナビ）
======================================== */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.cal-month-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    letter-spacing: 0.08em;
}

.cal-nav {
    background: none;
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.cal-nav:hover {
    border-color: #8B2500;
    color: #8B2500;
    background: #FFF8F5;
}

/* ========================================
   凡例
======================================== */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 20px;
    padding: 10px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #555;
}

.cal-legend-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.cal-legend--open .cal-legend-dot   { background: #43A047; }
.cal-legend--closed .cal-legend-dot { background: #E53935; }
.cal-legend--event .cal-legend-dot  { background: #1E88E5; }
.cal-legend--today .cal-legend-dot  { background: rgba(200, 150, 62, 0.35); }

/* ========================================
   カレンダーグリッド
======================================== */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: #e8e5e0;
    border: 1px solid #e8e5e0;
    border-radius: 4px;
    overflow: hidden;
}

/* 曜日ヘッダー */
.cal-dow {
    background: #F5F3F0;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 10px 4px;
    color: #555;
}

.cal-dow--sun { color: #E53935; }
.cal-dow--sat { color: #1E88E5; }

/* 日付セル */
.cal-cell {
    background: #fff;
    min-height: 90px;
    min-width: 0;
    padding: 6px;
    display: flex;
    flex-direction: column;
    transition: background 0.2s ease;
    position: relative;
    overflow: hidden;
}

.cal-cell--empty {
    background: #FAFAF8;
    min-height: 90px;
    min-width: 0;
}

/* 曜日色 */
.cal-cell--sun .cal-day-number { color: #E53935; }
.cal-cell--sat .cal-day-number { color: #1E88E5; }

/* 今日ハイライト */
.cal-cell--today {
    background: rgba(200, 150, 62, 0.12) !important;
}

.cal-cell--today .cal-day-number {
    background: #C8963E;
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* イベントタイプ別の背景 */
.cal-cell--open {
    background: #F1F8E9;
}

.cal-cell--closed {
    background: #FFF5F5;
}

.cal-cell--event {
    background: #E8F4FD;
}

/* 今日 + イベントタイプの組合せ */
.cal-cell--today.cal-cell--open   { background: rgba(67, 160, 71, 0.15) !important; }
.cal-cell--today.cal-cell--closed { background: rgba(229, 57, 53, 0.12) !important; }
.cal-cell--today.cal-cell--event  { background: rgba(30, 136, 229, 0.12) !important; }

/* 日付番号 */
.cal-day-number {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1;
}

/* イベントラベル */
.cal-event-label {
    display: block;
    font-size: 0.65rem;
    line-height: 1.3;
    padding: 2px 4px;
    border-radius: 2px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-event-label--open {
    background: #43A047;
    color: #fff;
}

.cal-event-label--closed {
    background: #E53935;
    color: #fff;
}

.cal-event-label--event {
    background: #1E88E5;
    color: #fff;
}

/* ローディング */
.cal-loading {
    text-align: center;
    padding: 60px 0;
    color: #999;
    font-size: 0.9rem;
}

/* タップ誘導文言（PC非表示） */
.cal-tap-hint {
    display: none;
}

/* 予定ありセルのタップカーソル（スマホ・タブレット用、JSで判定） */
.cal-cell--has-event {
    cursor: default;
}

/* ========================================
   ポップアップ
======================================== */
.cal-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.cal-popup-overlay.is-active {
    display: flex;
}

.cal-popup {
    background: #fff;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    padding: 28px 24px 24px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: calPopupIn 0.25s ease;
}

@keyframes calPopupIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.cal-popup-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 0.7rem;
    color: #999;
    letter-spacing: 0.03em;
}

.cal-popup-date {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8e5e0;
    letter-spacing: 0.05em;
}

.cal-popup-event {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0ede8;
}

.cal-popup-event:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cal-popup-type {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 3px;
    color: #fff;
    margin-bottom: 8px;
}

.cal-popup-type--open   { background: #43A047; }
.cal-popup-type--closed { background: #E53935; }
.cal-popup-type--event  { background: #1E88E5; }

.cal-popup-time {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.cal-popup-label {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
}

/* ========================================
   タブレット
======================================== */
@media (max-width: 768px) {
    #takoyaki-calendar {
        padding: 16px;
        border-radius: 0;
        box-shadow: none;
        background: #fff;
    }

    .cal-month-title {
        font-size: 1.1rem;
    }

    .cal-nav {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .cal-cell {
        min-height: 70px;
        padding: 4px;
    }

    .cal-cell--empty {
        min-height: 70px;
    }

    .cal-day-number {
        font-size: 0.8rem;
    }

    .cal-event-label {
        font-size: 0.55rem;
        padding: 1px 3px;
    }

    .cal-dow {
        font-size: 0.7rem;
        padding: 8px 2px;
    }

    .cal-legend {
        gap: 10px;
    }

    .cal-legend-item {
        font-size: 0.7rem;
    }

    /* タップ誘導文言を表示 */
    .cal-tap-hint {
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: #999;
        margin-bottom: 12px;
        letter-spacing: 0.03em;
    }

    /* 予定ありセルにタップカーソル */
    .cal-cell--has-event {
        cursor: pointer;
    }
}

/* ========================================
   スマートフォン（小）
======================================== */
@media (max-width: 480px) {
    #takoyaki-calendar {
        padding: 10px;
    }

    .cal-header {
        margin-bottom: 10px;
    }

    .cal-month-title {
        font-size: 1rem;
    }

    .cal-nav {
        padding: 5px 8px;
        font-size: 0.7rem;
        border-width: 1px;
    }

    .cal-cell {
        min-height: 56px;
        padding: 3px;
    }

    .cal-cell--empty {
        min-height: 56px;
    }

    .cal-day-number {
        font-size: 0.75rem;
    }

    .cal-cell--today .cal-day-number {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    .cal-event-label {
        font-size: 0.5rem;
        padding: 1px 2px;
        line-height: 1.2;
    }

    .cal-dow {
        font-size: 0.65rem;
        padding: 6px 1px;
    }

    .cal-legend {
        gap: 6px;
        padding: 6px 0;
    }

    .cal-legend-item {
        font-size: 0.6rem;
        gap: 3px;
    }

    .cal-legend-dot {
        width: 10px;
        height: 10px;
    }
}
