/* フェードインアニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 停留所マーカーのフェードイン */
.stop-marker.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* 停留所ラベルのスタイル */
.stop-label {
    background: rgba(255, 255, 255, 1.0);
    border: 1px solid #666;
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #222;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease-in;
}

.stop-label:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

/* バス停ラベル */
.bus-stop-label {
    background: rgba(255, 255, 255, 1.0);
    border: 2px solid #FF0000;
    color: #FF0000;
}

/* 電停ラベル */
.tram-stop-label {
    background: rgba(255, 255, 255, 1.0);
    border: 2px solid #FFB300;
    color: #B8860B;
}

/* 選択中のバス停/電停マーカー */
.leaflet-marker-selected {
    filter: drop-shadow(0 0 10px rgba(33, 150, 243, 0.8));
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* 選択中の停留所ラベル */
.stop-label.selected {
    background: #2196F3;
    color: white;
    font-weight: bold;
    transform: scale(1.1);
    z-index: 1000;
}

.bus-stop-label.selected {
    background: #2196F3;
    border-color: #1976D2;
    color: white;
}

.tram-stop-label.selected {
    background: #2196F3;
    border-color: #1976D2;
    color: white;
}

/* ズームレベルに応じて表示/非表示 */
.leaflet-zoom-0 .stop-label,
.leaflet-zoom-1 .stop-label,
.leaflet-zoom-2 .stop-label,
.leaflet-zoom-3 .stop-label,
.leaflet-zoom-4 .stop-label,
.leaflet-zoom-5 .stop-label,
.leaflet-zoom-6 .stop-label,
.leaflet-zoom-7 .stop-label,
.leaflet-zoom-8 .stop-label,
.leaflet-zoom-9 .stop-label,
.leaflet-zoom-10 .stop-label,
.leaflet-zoom-11 .stop-label,
.leaflet-zoom-12 .stop-label {
    display: none;
}

/* ズームレベル13以上で表示 */
.leaflet-zoom-13 .stop-label,
.leaflet-zoom-14 .stop-label,
.leaflet-zoom-15 .stop-label,
.leaflet-zoom-16 .stop-label,
.leaflet-zoom-17 .stop-label,
.leaflet-zoom-18 .stop-label,
.leaflet-zoom-19 .stop-label,
.leaflet-zoom-20 .stop-label {
    display: block;
}

/* カスタムポップアップスタイル（時刻表付き） */
.custom-popup {
    width: 600px !important;
    max-width: 600px !important;
}

.custom-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
}

.custom-popup .leaflet-popup-content {
    margin: 0;
    width: 100% !important;
    min-width: 580px;
}

.popup-container {
    display: flex;
    width: 100%;
    min-height: 200px;
    background: white;
}

.popup-info {
    flex: 0 0 250px;
    padding: 15px;
    border-right: 2px solid #e0e0e0;
}

.popup-info h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
}

.popup-info .stop-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
}

.popup-info .bus-type {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}

.popup-info .tram-type {
    background: #fff9c4;
    color: #f57f17;
    border: 1px solid #fbc02d;
}

.popup-info .stop-details {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

.popup-info .current-route {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.popup-info .route-name {
    font-weight: bold;
    color: #2196f3;
}

.popup-timetable {
    flex: 1;
    padding: 15px;
    background: #f5f5f5;
    overflow-y: auto;
    max-height: 400px;
}

/* 現在地フローティングパネル */
.location-floating-panel {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 10px 12px;
    min-width: 260px;
    max-width: 90vw;
    backdrop-filter: blur(4px);
}

.location-floating-panel.collapsed {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    min-width: auto;
    max-width: none;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.location-panel-header {
    font-size: 14px;
    font-weight: 600;
    color: #F57C00;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.location-panel-status {
    font-size: 13px;
    color: #333;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

.location-collapsed-chip {
    display: none;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #2e7d32;
}

.location-floating-panel.collapsed .location-panel-header,
.location-floating-panel.collapsed .location-panel-status,
.location-floating-panel.collapsed .location-panel-actions,
.location-floating-panel.collapsed #locationReacquireBtn {
    display: none;
}

.location-floating-panel.collapsed .location-collapsed-chip {
    display: flex;
}

.location-panel-actions {
    display: flex;
    gap: 6px;
}

.location-panel-btn {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-panel-btn.primary {
    background: #2196F3;
    color: #fff;
}

.location-panel-btn.secondary {
    background: #9C27B0;
    color: #fff;
}

.location-panel-btn.tertiary {
    background: #fff8e1;
    color: #F57C00;
    border: 1px solid #ffe0b2;
    width: 100%;
    margin-top: 6px;
    padding: 6px 8px;
}

.location-panel-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.location-panel-highlight {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.25), 0 6px 14px rgba(0, 0, 0, 0.2);
}

@media (max-width: 640px) {
    .location-floating-panel {
        top: 8px;
        left: 12px;
        transform: none;
        right: 12px;
        width: auto;
    }

    .location-floating-panel.collapsed {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

.popup-timetable h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #555;
}

.timetable-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 5px;
}

.time-item {
    background: white;
    padding: 5px 8px;
    border-radius: 4px;
    text-align: center;
    font-family: monospace;
    font-size: 13px;
    border: 1px solid #e0e0e0;
}

.time-item:hover {
    background: #e3f2fd;
    border-color: #2196f3;
}

.time-item .hour {
    font-weight: bold;
    color: #333;
}

.time-item .minute {
    color: #666;
}

.loading-message {
    text-align: center;
    padding: 20px;
    color: #999;
}

.error-message {
    text-align: center;
    padding: 20px;
    color: #f44336;
}

.no-timetable {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* 時刻表グリッドスタイル */
.timetable-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hour-group {
    display: flex;
    align-items: flex-start;
    background: white;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.hour-label {
    flex: 0 0 50px;
    font-weight: bold;
    color: #333;
    padding-right: 10px;
    border-right: 2px solid #e0e0e0;
    margin-right: 10px;
}

.minutes-list {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.minutes-list .time-item {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
    min-width: 25px;
    text-align: center;
}

/* 乗車駅・降車駅のツールチップスタイル */
.boarding-station-tooltip {
    background-color: #4CAF50 !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    border: 2px solid #388E3C !important;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.5) !important;
}

.boarding-station-tooltip::before {
    border-top-color: #4CAF50 !important;
}

.alighting-station-tooltip {
    background-color: #F44336 !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    border: 2px solid #D32F2F !important;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.5) !important;
}

.alighting-station-tooltip::before {
    border-top-color: #F44336 !important;
}

/* 経路検索結果タブのスタイル */
.route-tabs-container {
    width: 100%;
}

.route-tabs-header {
    display: flex;
    gap: 5px;
    margin: 10px 0;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}

.route-tab-button {
    flex: 1;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px 8px 0 0;
    font-family: inherit;
    position: relative;
    bottom: -2px;
}

.route-tab-button:hover {
    background: #e3f2fd;
}

.route-tab-button.active {
    background: white;
    border-color: #2196F3;
    border-bottom: 2px solid white;
    z-index: 1;
}

.route-tab-title {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.route-tab-button.active .route-tab-title {
    color: #2196F3;
}

.route-tab-summary {
    font-size: 12px;
    color: #666;
}

.route-tabs-content {
    background: white;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.route-tab-panel {
    display: none;
}

.route-tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

/* 経路詳細のスタイル改善 */
.route-detail {
    margin-top: 15px;
}

.route-step {
    transition: all 0.2s ease;
}

.route-step:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 車両マーカーのスタイル */
.vehicle-marker-icon {
    background: transparent !important;
    border: none !important;
}

.bus-emoji {
    font-size: 30px;
    line-height: 30px;
    text-align: center;
    animation: vehiclePulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
    transform-origin: center center;
    display: inline-block;
}

@keyframes vehiclePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.vehicle-direction-marker {
    animation: fadeIn 0.3s ease-in;
}

/* 車両マーカーのスムーズな移動は、requestAnimationFrameで実装されているため
   CSSのtransitionは不要。元の.bus-emojiのバウンドアニメーションを維持 */
