/**
 * Veil Tokyo
 * Schedule Page (page-schedule.php)
 */

/* ==========================================================================
   0. PAGE SPECIFIC OVERRIDES & UTILITIES
   ========================================================================== */
.d-none {
    display: none;
}

/* ==========================================================================
   1. SCHEDULE PAGE CONTAINER & VIEW TABS
   ========================================================================== */
.schedule-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: var(--space-32);
    padding-bottom: 120px;
    position: relative;
    z-index: 2;
}

.schedule-section-inner {
    padding-top: var(--space-32);
    padding-bottom: var(--space-64);
    position: relative;
}

/* 3表示モード切り替えタブ */
.schedule-view-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-16);
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: var(--space-8);
    border-bottom: 1px solid var(--border-thin);
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
}

/* スマホ表示時(768px以下)に左端が画面外へ見切れる現象を物理防止 */
@media (max-width: 768px) {
    .schedule-view-tabs {
        justify-content: flex-start;
        padding-left: 0;
        padding-right: 0;
        gap: var(--space-8);
    }
    .schedule-view-tab {
        padding: var(--space-10) var(--space-16);
        font-size: 12px;
    }
}

.schedule-view-tab {
    padding: var(--space-12) var(--space-32);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-thin);
    border-radius: 40px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.schedule-view-tab:hover {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
    background-color: var(--accent-gold-light);
}

.schedule-view-tab.active {
    background-color: var(--accent-gold);
    color: var(--bg-base);
    border-color: var(--accent-gold);
    box-shadow: 0 0 16px var(--accent-gold-light);
}

.schedule-view-content {
    transition: opacity 0.4s ease;
}

/* ==========================================================================
   2. WEEKLY GANTT CHART TABLE (週間出勤表 ＆ 粘着固定列)
   ========================================================================== */
.gantt-chart-card-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-thin);
    border-radius: var(--radius-md);
    padding: var(--space-24);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .gantt-chart-card-box {
        padding: var(--space-16) var(--space-12);
    }
}

.gantt-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-16);
    padding-bottom: var(--space-16);
    border-bottom: 1px solid var(--border-thin);
    flex-wrap: wrap;
    gap: var(--space-8);
}

.chart-header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 1px;
}

.chart-header-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.gantt-chart-scroll-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-thin);
}

.gantt-chart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px;
}

.gantt-chart-table th,
.gantt-chart-table td {
    padding: var(--space-12) var(--space-8);
    text-align: center;
    border-bottom: 1px solid var(--border-thin);
    transition: background-color 0.2s ease;
}

.gantt-chart-table tbody tr:hover td {
    background-color: var(--accent-gold-watermark);
}

/* 時間指定予約バッジのホバースタイル強化 */
.gantt-chart-table td .time-badge {
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.gantt-chart-table td .time-badge:hover {
    background-color: var(--accent-gold);
    color: var(--bg-base);
    box-shadow: 0 0 12px var(--accent-gold-light);
    transform: translateY(-1px);
}

/* 左端キャスト名の粘着固定列（Sticky） */
.col-cast-sticky {
    position: sticky;
    left: 0;
    background-color: var(--bg-surface);
    z-index: 10;
    width: 180px;
    min-width: 180px;
    max-width: 220px;
    text-align: left;
    border-right: 1px solid var(--border-thin);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
}

/* スマホ表示時(768px以下)にキャスト粘着列幅をスリム化し右側スケジュール領域を広く確保 */
@media (max-width: 768px) {
    .gantt-chart-table tbody td.col-cast-sticky,
    .gantt-chart-table thead th.col-cast-sticky {
        width: 125px;
        min-width: 125px;
        max-width: 125px;
        padding: 8px 6px;
    }
    .gantt-chart-table td .chart-cast-thumb {
        width: 28px;
        height: 38px;
    }
    .gantt-chart-table td .chart-cast-name {
        font-size: 11px;
        letter-spacing: 0;
    }
    .gantt-chart-table th,
    .gantt-chart-table td {
        padding: 8px 4px;
        font-size: 11px;
    }
}

.chart-cast-cell-link {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.chart-cast-cell-link:hover .chart-cast-name {
    color: var(--accent-gold);
}

.chart-cast-thumb {
    width: 36px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-accent);
    flex-shrink: 0;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.chart-cast-cell-link:hover .chart-cast-thumb {
    transform: scale(1.05);
    border-color: var(--accent-gold);
}

.chart-cast-name {
    font-size: 13px;
    line-height: 1.3;
    color: var(--text-main);
    word-break: break-all;
}

.gantt-chart-table tbody tr:hover .col-cast-sticky {
    background-color: var(--bg-surface-elevated);
}

.gantt-chart-table th.col-cast-sticky {
    background-color: var(--bg-surface-elevated);
    color: var(--text-main);
}

.chart-header-date {
    width: 80px;
    min-width: 80px;
    background-color: var(--bg-base);
    color: var(--text-muted);
    font-weight: 700;
    line-height: 1.4;
}

/* 凡例領域 */
.chart-legend-box {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-24);
    flex-wrap: wrap;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-thin);
    padding: var(--space-16);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--text-muted);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-8);
}

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

.status-instant {
    background-color: #10B981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-open {
    background-color: #3B82F6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.status-off {
    background-color: var(--border-thin);
}

/* ==========================================================================
   3. MONTHLY CALENDAR VIEW (月間カレンダー ＆ 日付セル)
   ========================================================================== */
#view-calendar-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.calendar-card-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-thin);
    border-radius: var(--radius-md);
    padding: var(--space-32) var(--space-24);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
    width: 100%;
    box-sizing: border-box;
}

.calendar-header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-24);
    padding-bottom: var(--space-16);
    border-bottom: 1px solid var(--border-thin);
}

.calendar-month-title {
    font-family: var(--font-en);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 2px;
}

.calendar-nav-btns {
    display: flex;
    gap: var(--space-8);
}

.btn-cal-nav {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-thin);
    background-color: var(--bg-base);
    color: var(--accent-gold);
    border-radius: var(--radius-sm);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-cal-nav:hover {
    border-color: var(--accent-gold);
    background-color: var(--accent-gold-light);
    transform: scale(1.05);
}

/* カレンダー7列グリッド */
.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--space-8);
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: var(--space-8);
    width: 100%;
    box-sizing: border-box;
}

.calendar-grid-header .sun {
    color: #FFB3B3;
}

.calendar-grid-header .sat {
    color: #93C5FD;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--space-8);
    width: 100%;
    box-sizing: border-box;
}

.cal-day-cell {
    background-color: var(--bg-base);
    border: 1px solid var(--border-thin);
    border-radius: var(--radius-sm);
    padding: var(--space-12) var(--space-8);
    min-height: 90px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.cal-day-cell:hover {
    border-color: var(--accent-gold);
    background-color: var(--bg-surface-elevated);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.cal-day-cell.today {
    border-color: var(--accent-gold);
    background-color: var(--accent-gold-watermark);
    box-shadow: inset 0 0 12px var(--accent-gold-light);
}

.cal-day-num {
    font-family: var(--font-num);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.cal-day-count {
    font-size: 11px;
    color: var(--accent-gold);
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

/* スマホ表示時(768px以下)の月間カレンダー絶対収まり＆11px指定最適化 */
@media (max-width: 768px) {
    #view-calendar-container {
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    #view-calendar-container .calendar-card-box {
        padding: var(--space-12) 4px;
        border-left: none;
        border-right: none;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    #view-calendar-container .calendar-grid-header,
    #view-calendar-container .calendar-days-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 2px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    #view-calendar-container .calendar-grid-header {
        font-size: 11px;
    }
    #view-calendar-container .cal-day-cell {
        min-height: 56px;
        min-width: 0;
        padding: 4px 1px;
        width: 100%;
        box-sizing: border-box;
    }
    #view-calendar-container .cal-day-num {
        font-size: 11px;
        line-height: 1;
    }
    #view-calendar-container .cal-day-count {
        font-size: 11px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.1;
        width: 100%;
        display: block;
    }
}

/* ==========================================================================
   4. CALENDAR DAY DETAIL MODAL (出勤キャストモーダル)
   ========================================================================== */
#calendar-day-modal .modal-box.max-w-640 {
    max-width: 640px;
}

.border-bottom-thin {
    border-bottom: 1px solid var(--border-thin);
}

.modal-casts-scroll-list {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    padding-right: var(--space-4);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-gold) var(--bg-surface);
}

.modal-cast-row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-12);
    background-color: var(--bg-base);
    border: 1px solid var(--border-thin);
    border-radius: var(--radius-sm);
    gap: var(--space-12);
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.modal-cast-row-item:hover {
    border-color: var(--accent-gold);
}

.modal-cast-thumb {
    width: 64px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-accent);
    flex-shrink: 0;
}

/* モーダル内「予約する」ボタンのスマホ型崩れ・縦折り返しを完全防止 */
.modal-cast-row-item .btn {
    white-space: nowrap;
    word-break: keep-all;
    padding: 0 var(--space-12);
    font-size: 12px;
    height: 38px;
    flex-shrink: 0;
    min-width: max-content;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-cast-row-item .btn::after {
    display: none;
}

@media (max-width: 576px) {
    .modal-cast-row-item {
        padding: var(--space-8);
        gap: var(--space-8);
    }
    .modal-cast-thumb {
        width: 44px;
        height: 56px;
    }
    .modal-cast-row-item .btn {
        padding: 0 var(--space-8);
        font-size: 11px;
        height: 34px;
    }
}

/* ==========================================================================
   5. PICKUP CASTS & FAQ & CTA (画面下部追従ボタンとの重なり防止)
   ========================================================================== */
.system-faq-section {
    padding-top: var(--space-64);
    padding-bottom: var(--space-64);
    border-top: 1px solid var(--border-thin);
}

.system-casts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-24);
    margin-top: var(--space-32);
    margin-bottom: var(--space-64);
}

@media (max-width: 1023px) {
    .system-casts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-16);
        margin-bottom: var(--space-48);
    }
}

@media (max-width: 576px) {
    .system-casts-grid {
        grid-template-columns: 1fr;
        gap: var(--space-16);
        margin-bottom: var(--space-40);
    }
}

.system-cta-section {
    padding-top: var(--space-64);
    padding-bottom: 120px;
}

.max-w-768 {
    max-width: 768px;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}