/* =============================================
   Availability Calendar - フロントエンドスタイル
   詳細度強化版：th/td に徹底的な色指定 ＋ 枠・時間列の両方を固定
   ============================================= */

/* ルートコンテナ */
.avcal-front-wrap.avcal-front-wrap {
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif !important;
    margin: 20px 0 !important;
    background: #fff !important;
    border-radius: 10px !important;
    border: 1px solid #d1d9e0 !important;
    box-shadow: 0 2px 12px rgba(26,42,58,0.08) !important;
    overflow: hidden !important;
    position: relative !important;
}

/* ヘッダー（ナビゲーション） */
.avcal-front-wrap .avcal-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    background: #f4f7f9 !important;
    border-bottom: 2px solid #bf865e !important;
    padding: 12px 16px !important;
    gap: 8px !important;
}

.avcal-front-wrap .avcal-period-label {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #1a2a3a !important;
    text-align: center !important;
    letter-spacing: 0.02em !important;
    width: 100% !important;
}

/* ナビボタン行 */
.avcal-front-wrap .avcal-nav-btns {
    display: flex !important;
    justify-content: space-between !important;
    gap: 10px !important;
}

.avcal-front-wrap .avcal-nav-btn {
    background: #1a2a3a !important;
    border: none !important;
    color: #fff !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s, opacity 0.15s !important;
    white-space: nowrap !important;
    letter-spacing: 0.02em !important;
    margin: 0 !important;
}

.avcal-front-wrap .avcal-nav-btn:hover {
    background: #2a3f56 !important;
    opacity: 0.9 !important;
}

/* テーブルスクロール */
.avcal-front-wrap .avcal-table-scroll {
    overflow-x: auto !important;
    display: block !important; /* テーブルが潰れないようにブロック要素として明示 */
    width: 100% !important;
}

/* テーブル全体 */
.avcal-front-wrap .avcal-front-table {
    /* width: 100% !important; */
    /* min-width: 520px !important; */
    width: max-content !important;
    font-size: 0.9rem !important;
    margin-bottom: 0 !important;
    border-collapse: separate !important; /* collapse から変更 */
    border-spacing: 0 !important;        /* 隙間を0に */
    table-layout: fixed !important; /* 幅を強制固定 */
}

/* 【重要】th, td の色をテーマより優先 */
.avcal-front-wrap .avcal-front-table th,
.avcal-front-wrap .avcal-front-table td {
    border: 1px solid #d1d9e0 !important;
    box-sizing: border-box !important;
    text-align: center !important;
    vertical-align: middle !important;
    padding: 8px 4px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap !important;
    /* テーマ側の color, background-color を無効化 */
    background-color: #fff !important;
    color: #333 !important;
}

/* ヘッダー行の背景色を再指定 */
.avcal-front-wrap .avcal-front-table thead tr th {
    position: sticky !important;
    top: 0 !important;
    background: #f4f7f9 !important;
    z-index: 20 !important; /* 横列固定より上にくるように */
}

/* 最重要：左上の角（1列目・2列目のヘッダー）を最前面へ */
.avcal-front-wrap .avcal-front-table thead .th-slot,
.avcal-front-wrap .avcal-front-table thead .th-time {
    z-index: 30 !important; 
}

/* 【変更】枠番号列ヘッダー：横スクロール固定 */
.avcal-front-wrap .avcal-front-table .th-slot,
.avcal-front-wrap .avcal-front-table .td-slot {
    position: sticky !important;
    left: 0 !important;
    width: 40px !important;      /* 幅を固定 */
    min-width: 40px !important;
    max-width: 40px !important;
    z-index: 10 !important;
    font-weight: 700 !important;
    color: #1a2a3a !important;
    background: #f4f7f9 !important;
    font-size: 0.85rem !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08) !important;
}

/* 【変更】時間列ヘッダー：横スクロール固定（枠の右隣なので left: 40px） */
.avcal-front-wrap .avcal-front-table .th-time,
.avcal-front-wrap .avcal-front-table .td-time {
    position: sticky !important;
    left: 40px !important;     /* 1列目の幅(40px)と完全に一致させる */
    width: 90px !important;      /* スマホ等で可変にしないよう固定推奨 */
    min-width: 90px !important;
    z-index: 10 !important;
    font-size: 1.125rem !important;  /* 日付と同じサイズ */
    font-weight: 600 !important;
    color: #666666 !important;
    background: #f4f7f9 !important;
    text-align: center !important;
    padding: 8px 6px !important;
    white-space: normal !important;
    line-height: 1.3 !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05) !important;
    z-index: 10 !important;
}

.avcal-front-wrap .avcal-front-table .th-day {
    min-width: 52px !important;
    font-size: 0.85rem !important;
    background: #f4f7f9 !important;
    color: #1a2a3a !important;
}

.avcal-front-wrap .avcal-front-table .day-num {
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    color: #1a2a3a !important;
    line-height: 1.2 !important;
}

.avcal-front-wrap .avcal-front-table .day-dow {
    font-size: 0.75rem !important;
    margin-top: 2px !important;
    line-height: 1.2 !important;
    color: #666 !important;
}

/* 土曜日 */
.avcal-front-wrap .avcal-front-table .col-sat {
    background-color: #eff6ff !important;
}
.avcal-front-wrap .avcal-front-table .col-sat .day-num,
.avcal-front-wrap .avcal-front-table .col-sat .day-dow {
    color: #1a56db !important;
}

/* 日曜・祝日 */
.avcal-front-wrap .avcal-front-table .col-sun {
    background-color: #fff5f5 !important;
}
.avcal-front-wrap .avcal-front-table .col-sun .day-num,
.avcal-front-wrap .avcal-front-table .col-sun .day-dow {
    color: #c0392b !important;
}

/* 【変更】枠番号列セル：横スクロール固定 */
.avcal-front-wrap .avcal-front-table .td-slot {
    position: sticky !important;
    left: 0 !important;
    z-index: 10 !important;  /* データ行 */
    font-weight: 700 !important;
    color: #1a2a3a !important;
    background: #f4f7f9 !important;
    font-size: 0.9rem !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08) !important;
}

/* 【変更】時間列セル：横スクロール固定（枠の右隣なので left: 40px） */
.avcal-front-wrap .avcal-front-table .td-time {
    position: sticky !important;
    left: 40px !important;  /* 枠列の幅分だけずらす */
    z-index: 9 !important;
    font-size: 1.125rem !important;  /* 日付と同じサイズ */
    font-weight: 600 !important;
    color: #666666 !important;
    background: #f4f7f9 !important;
    text-align: center !important;
    padding: 8px 6px !important;
    white-space: normal !important;
    line-height: 1.3 !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05) !important;
}

.avcal-front-wrap .avcal-front-table .td-status {
    padding: 6px 2px !important;
    background: #fff !important;  /* ステータスセルは白背景 */
}

/* ステータスバッジ */
.avcal-front-wrap .status-badge {
    display: inline-block !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
}

.avcal-front-wrap .st-available {
    color: #15803d !important;
}

.avcal-front-wrap .st-tentative {
    color: #92400e !important;
}

.avcal-front-wrap .st-unavailable {
    color: #b91c1c !important;
}

.avcal-front-wrap .st-out_of_period {
    color: #6b7280 !important;  /* グレー */
}

.avcal-front-wrap .st-not_public {
    color: #7c3aed !important;  /* パープル */
}

/* 凡例 */
.avcal-front-wrap .avcal-legend-front {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    padding: 12px 16px !important;
    background: #f4f7f9 !important;
    border-top: 1px solid #d1d9e0 !important;
    flex-wrap: wrap !important;
}

.avcal-front-wrap .lf-item {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    padding: 3px 10px !important;
    border-radius: 4px !important;
}

.avcal-front-wrap .lf-item.available {
    background: #dcfce7 !important;
    color: #15803d !important;
}

.avcal-front-wrap .lf-item.tentative {
    background: #fef9c3 !important;
    color: #92400e !important;
}

.avcal-front-wrap .lf-item.unavailable {
    background: #fee2e2 !important;
    color: #b91c1c !important;
}

.avcal-front-wrap .lf-item.out_of_period {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
}

.avcal-front-wrap .lf-item.not_public {
    background: #ede9fe !important;
    color: #7c3aed !important;
}

/* レスポンシブ */
@media (max-width: 600px) {
    .avcal-front-wrap .avcal-header {
        padding: 10px 10px !important;
    }
    .avcal-front-wrap .avcal-nav-btn {
        font-size: 0.75rem !important;
        padding: 5px 8px !important;
    }
    .avcal-front-wrap .avcal-period-label {
        font-size: 0.8rem !important;
    }
    .avcal-front-wrap .status-badge {
        font-size: 0.85rem !important;
    }
    .avcal-front-wrap .avcal-front-table .day-num {
        font-size: 0.9rem !important;
    }
    .avcal-front-wrap .avcal-front-table .th-time,
    .avcal-front-wrap .avcal-front-table .td-time {
        font-size: 0.9rem !important;
        width: 70px !important;
        min-width: 70px !important;
    }
}
