/* ==== ルート管理UI スタイル ==== */

.route-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

/* 横並びの操作ボタン行 */
.route-controls-row {
    display: flex;
    gap: 8px;
}
.route-controls-row .route-btn {
    flex: 1 1 0;
}

/* 個別ボタン色（有効時のみ色付け） */
#btnStartRoute.route-btn:not(:disabled) {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}
#btnStartRoute.route-btn:not(:disabled):hover {
    background: #2563eb;
}

#btnSaveRoute.route-btn:not(:disabled) {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}
#btnSaveRoute.route-btn:not(:disabled):hover {
    background: #059669;
}

#btnStopRoute.route-btn:not(:disabled) {
    background: #e5e7eb; /* 薄いグレー */
    border-color: #d1d5db;
    color: #374151;
}
#btnStopRoute.route-btn:not(:disabled):hover {
    background: #dfe3e8;
}

.route-btn {
    padding: 6px 10px; /* 高さを抑える */
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.route-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.route-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.route-btn.primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.route-btn.primary:hover:not(:disabled) {
    background: #2563eb;
}

.route-btn.secondary {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.route-btn.secondary:hover:not(:disabled) {
    background: #4b5563;
}

.route-btn.success {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.route-btn.success:hover:not(:disabled) {
    background: #059669;
}

.route-status {
    padding: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 12px;
    color: #1e40af;
    margin-bottom: 12px;
    display: none;
}

.route-save-form {
    padding: 8px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 12px;
}

.route-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 6px;
}

.route-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.route-list-section {
    margin-top: 16px;
}

.route-list-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.route-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.route-item {
    padding: 4px 6px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: all 0.2s;
}

.route-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.route-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.route-name {
    font-weight: 600;
    color: #111827;
    font-size: 13px;
}

.route-points {
    font-size: 11px;
    color: #6b7280;
    background: #e5e7eb;
    padding: 1px 6px;
    border-radius: 12px;
}

.route-item-date {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 0;
}

/* per-item action buttons were removed; toolbar used instead */

.empty-message {
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    padding: 24px;
}

.route-stats-panel {
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.route-stats-panel h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.route-stats-panel h4 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 12px 0 8px 0;
}

.route-stats {
    font-size: 12px;
}

.stat-item {
    padding: 4px 0;
    border-bottom: 1px solid #e5e7eb;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 2px;
}

.stat-values {
    display: flex;
    gap: 6px;
    color: #6b7280;
    font-size: 11px;
}

.stat-values span {
    background: #e5e7eb;
    padding: 1px 6px;
    border-radius: 4px;
}

.stat-section {
    margin-top: 12px;
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
    .route-item-actions {
        flex-direction: column;
    }
    
    .stat-values {
        flex-direction: column;
        gap: 4px;
    }
}

/* ===== 統計ポップアップ（虫眼鏡）スタイル ===== */
.maplibregl-popup.route-stats-popup {
    z-index: 10000;
}
.maplibregl-popup.route-stats-popup .maplibregl-popup-content {
    /* 縦横を縮小（幅を現状の0.6倍に） */
    width: 234px; /* 390px * 0.6 */
    max-width: 90vw;
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
}

.maplibregl-popup.route-stats-popup .maplibregl-popup-content > div {
    /* 内側スクロール領域：高さを現状の0.4倍に */
    max-height: 20vh; /* 50vh * 0.4 */
    overflow-y: auto;
    padding: 12px 14px;
}

.maplibregl-popup.route-stats-popup .route-stats .stat-item {
    padding: 10px 0;
}

/* ===== ルートパネル 高さを0.6倍に制限 ===== */
#routePanel.floating-panel {
    /* 全体の最大高さを 60vh に抑制（従来 100vh 基準→0.6倍） */
    max-height: 60vh;
}

#routePanel .panel-body {
    /* パネル内スクロール領域の高さを調整（従来 100vh - 120px → 60vh - 72px 相当） */
    max-height: calc(60vh - 72px);
}

@media (max-width: 720px) {
    #routePanel.floating-panel {
        /* モバイルでは従来 60vh → その 0.6 倍 */
        max-height: 36vh;
        bottom: 72px; /* 既存のモバイル配置と整合 */
    }
    #routePanel .panel-body {
        max-height: calc(36vh - 72px);
    }
}
