/**
 * 各駅時刻表ページ用スタイル
 * 駅のホームにある時刻表に近いデザイン
 *
 * @package LocalTrainSearch
 */

.station-timetable-page .container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* 各駅時刻表ページ内の路線図：出発・到着のコントロールは非表示 */
.station-timetable-section .route-map-container .map-controls {
    display: none;
}

.station-timetable-placeholder {
    text-align: center;
    padding: 24px;
    margin: 16px 0;
    background: #f5f5f5;
    border: 1px dashed #ccc;
    border-radius: 8px;
    color: #666;
    font-size: 1rem;
}

/* ページタイトルエリア：駅名中央・左右矢印 */
.station-timetable-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.station-timetable-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    min-width: 200px;
}

.station-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-size: 2rem;
    line-height: 1;
    color: #333;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.station-nav-btn:hover {
    background: #e0e0e0;
    color: #000;
}

.station-nav-btn:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
}

.station-nav-btn.hidden {
    visibility: hidden;
    pointer-events: none;
}

/* 上り・下りタブと運行日フィルター */
.station-timetable-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.station-timetable-direction-tabs {
    display: flex;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.station-direction-tab {
    padding: 8px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    background: #f5f5f5;
    border: none;
    border-right: 1px solid #ccc;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.station-direction-tab:last-child {
    border-right: none;
}

.station-direction-tab:hover {
    background: #e8e8e8;
}

.station-direction-tab.active {
    background: #333;
    color: #fff;
}

.station-timetable-day-type-wrap {
    display: flex;
    align-items: center;
}

.station-timetable-filters label {
    margin-right: 8px;
    font-weight: bold;
}

.station-timetable-filters select {
    padding: 8px 12px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* テーブルラッパー（スケルトン表示時も高さを維持） */
.station-timetable-table-wrap {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    min-height: 580px;
}

.station-timetable-error {
    padding: 24px;
    text-align: center;
    margin: 0;
}

/* スケルトン（読み込み中は時刻表と同じレイアウトで高さを確保） */
.station-timetable-skeleton {
    min-height: 540px;
}

.station-timetable-skeleton-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.station-timetable-skeleton-table thead {
    background: #e8e8e8;
}

.station-timetable-skeleton-table th {
    padding: 12px 16px;
    text-align: left;
    border: 1px solid #e0e0e0;
}

.station-timetable-skeleton-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.station-timetable-skeleton-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.station-timetable-skeleton-table .station-timetable-hour-cell {
    width: 56px;
    padding: 10px;
    text-align: center;
    background: #f0f0f0;
    border-right: 1px solid #e0e0e0;
}

.station-timetable-skeleton-table .station-timetable-times-cell {
    padding: 8px 16px;
    border-left: 1px solid #e0e0e0;
}

.skeleton-line {
    display: inline-block;
    height: 14px;
    background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: station-skeleton-shimmer 1.2s ease-in-out infinite;
    border-radius: 4px;
    vertical-align: middle;
}

.skeleton-line-num {
    width: 20px;
}

.skeleton-line-short {
    width: 40px;
}

.skeleton-line-medium {
    width: 80px;
}

.skeleton-line-time {
    width: 60%;
    max-width: 120px;
}

@keyframes station-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.station-timetable-error {
    color: #c00;
    background: #ffebee;
}

/* 時刻表テーブル（ホームの時刻表風） */
.station-timetable-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.station-timetable-table thead {
    background: #333;
    color: #fff;
}

.station-timetable-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: bold;
    border: 1px solid #444;
}

.station-timetable-table .station-timetable-hour-col {
    width: 56px;
    text-align: center;
    vertical-align: middle;
}

.station-timetable-table .station-timetable-times-col {
    font-weight: normal;
    font-size: 0.85rem;
    min-width: 100px;
    text-align: left;
    border-left: 2px solid #555;
}

.station-timetable-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.station-timetable-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.station-timetable-table tbody tr:hover {
    background: #f0f7ff;
}

.station-timetable-table .station-timetable-hour-cell {
    width: 56px;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    background: #f5f5f5;
    border-right: 2px solid #555;
    vertical-align: top;
}

.station-timetable-table .station-timetable-times-cell {
    padding: 8px 16px;
    vertical-align: top;
    border-left: 2px solid #bbb;
}

/* 各時刻リンク（ホーム時刻表風） */
.station-time-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.station-time-list li {
    margin: 0;
    padding: 0;
}

.station-time-link {
    display: inline-block;
    padding: 2px 6px;
    color: #0066cc;
    text-decoration: none;
    border-radius: 2px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.95rem;
}

.station-time-link:hover {
    text-decoration: underline;
    background: #e3f2fd;
}

.station-time-link .train-type-limited {
    color: #c00;
    font-size: 0.75rem;
    margin-left: 4px;
    font-family: inherit;
}

/* モーダル */
.station-train-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.station-train-detail-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.station-train-detail-modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 24px;
}

.station-train-detail-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    line-height: 1;
    color: #666;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}

.station-train-detail-modal-close:hover {
    background: #f0f0f0;
    color: #000;
}

.station-train-detail-modal-title {
    margin: 0 0 16px;
    padding-right: 40px;
    font-size: 1.25rem;
}

.station-train-detail-modal-body {
    margin: 0;
}

.station-train-detail-loading {
    color: #666;
    margin: 0;
}

/* 列車詳細：停車駅一覧 */
.station-train-detail-stops {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.station-train-detail-stops th,
.station-train-detail-stops td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.station-train-detail-stops th {
    background: #f5f5f5;
    font-weight: bold;
}

.station-train-detail-stops .stop-time {
    font-family: "Consolas", "Monaco", monospace;
    white-space: nowrap;
}

.station-train-detail-stops .stop-name {
    font-weight: 500;
}

@media (max-width: 640px) {
    .station-timetable-header {
        flex-wrap: wrap;
        gap: 12px;
    }
    .station-timetable-title {
        order: -1;
        width: 100%;
        min-width: 0;
    }
    .station-timetable-table {
        font-size: 0.85rem;
    }
    .station-timetable-table .station-timetable-hour-cell,
    .station-timetable-table .station-timetable-hour-col {
        width: 44px;
    }
}
