#mtm-map-wrapper {
    width: 100%;
    height: 600px;
    border: 1px solid #ccc;
    position: relative;
    overflow: hidden; /* Clips the bottom sheet */
}

#mtm-map-container {
    width: 100%;
    height: 100%;
}

/* Loader */
#mtm-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out;
}

.mtm-loader-content {
    width: 80%;
    max-width: 400px;
    text-align: center;
}

.mtm-loader-logo {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 20px;
}

.mtm-progress-bg {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

#mtm-progress-bar {
    width: 0%;
    height: 100%;
    background: #0073aa;
    transition: width 0.3s ease;
}

.mtm-loader-status {
    font-size: 14px;
    color: #666;
}

/* Bottom Sheet */
#mtm-info-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px 15px 10px 15px;
    border-radius: 15px 15px 0 0;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 25%;
    overflow-y: auto;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(110%);
    font-size: 13px;
}

#mtm-info-panel.mtm-active {
    transform: translateY(0);
}

/* Toggle Button */
#mtm-drawer-toggle {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #ccc;
    width: 40px;
    height: 24px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 999;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #0073aa;
}

#mtm-info-panel::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
}

.mtm-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.mtm-panel-btn {
    background: #f0f0f0;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.mtm-overlap-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mtm-overlap-list li {
    padding: 4px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 15px;
    font-size: 11px;
}

.mtm-overlap-list li span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    display: inline-block;
    flex-shrink: 0;
}

/* Vehicle Tooltip */
.mtm-v-tip {
    padding: 5px 10px;
    font-size: 12px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.mtm-vehicle-tooltip .mapboxgl-popup-content {
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: none;
}

.mtm-vehicle-tooltip .mapboxgl-popup-tip {
    border-top-color: white;
}
.mtm-popup-stop h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

.mtm-stop-routes {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 5px;
}

.mtm-route-pill {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #eee;
    transition: background 0.2s;
}

.mtm-route-pill:hover {
    background: #f0f0f0;
}

/* Search bar */
#mtm-search-container {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 320px;
    z-index: 1005;
}
#mtm-route-search {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 14px;
    outline: none;
}
#mtm-route-search:focus {
    border-color: #0073aa;
}
#mtm-search-results {
    background: white;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    margin-top: -2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.mtm-search-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    font-size: 13px;
}
.mtm-search-item:last-child { border-bottom: none; }
.mtm-search-item:hover { background: #f9f9f9; }
.mtm-search-item-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}
.mtm-hide { display: none !important; }

/* Dashboard / Flyer */
#mtm-dashboard-container {
    margin-top: 30px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}
.mtm-flyer-section-top {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}
.mtm-flyer-block {
    flex: 1;
    min-width: 300px;
    border-radius: 10px;
    overflow: hidden;
}

/* Block Gauche: Info & Contact */
.mtm-flyer-info-contact {
    background: #fff;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
}
.mtm-flyer-info-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    text-transform: uppercase;
}
.mtm-flyer-qrcode {
    width: 100px;
    height: 100px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}
.mtm-flyer-socials {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}
.mtm-flyer-social-icon {
    width: 24px;
    height: 24px;
    background: #ddd;
    border-radius: 50%;
}
.mtm-flyer-logo {
    margin-top: auto;
    max-width: 150px;
    height: 40px;
    background: #eee;
    width: 100%;
}

/* Block Central: Plan de ligne */
.mtm-flyer-line-plan {
    background: #f7f7f7;
    padding: 60px 20px 40px 20px;
    position: relative;
    display: flex;
    align-items: center;
}
.mtm-flyer-bus-line {
    height: 8px;
    width: 100%;
    position: relative;
}
.mtm-flyer-stop-dot {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    z-index: 2;
}
.mtm-flyer-stop-name {
    position: absolute;
    bottom: 25px;
    left: 8px;
    transform: rotate(-45deg);
    transform-origin: left bottom;
    white-space: nowrap;
    font-size: 11px;
    color: #444;
    font-weight: 600;
}
.mtm-flyer-correspondance {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    width: 60px;
    justify-content: center;
}
.mtm-flyer-corresp-badge {
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
    background: #333;
    color: #fff;
    font-weight: bold;
}
.mtm-flyer-line-legend {
    position: absolute;
    bottom: 10px;
    left: 20px;
    right: 20px;
    font-size: 9px;
    color: #888;
    text-align: center;
}

/* Block Droit: Identité */
.mtm-flyer-identity {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mtm-flyer-commune {
    padding: 10px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
}
.mtm-flyer-route-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.mtm-flyer-route-label {
    font-size: 14px;
    text-transform: uppercase;
    margin-bottom: 5px;
}
.mtm-flyer-route-number {
    font-size: 64px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 15px;
}
.mtm-flyer-route-terminus {
    font-size: 13px;
    text-align: center;
    font-weight: bold;
    line-height: 1.3;
}

/* Section Basse: Horaires */
.mtm-flyer-section-bottom {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}
.mtm-flyer-timetable {
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
}
.mtm-flyer-table-header {
    padding: 12px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    border-radius: 10px 10px 0 0;
}
.mtm-flyer-table-container {
    overflow-x: auto;
}
.mtm-flyer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.mtm-flyer-table th, .mtm-flyer-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
}
.mtm-flyer-table .mtm-col-stop {
    background: #f9f9f9;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    position: sticky;
    left: 0;
    z-index: 1;
}
.mtm-flyer-table tr:nth-child(even) td:not(.mtm-col-stop) {
    background: #fafafa;
}
.mtm-flyer-time {
    text-align: center;
    font-family: monospace;
    color: #444;
}

/* Responsive */
@media (max-width: 900px) {
    .mtm-flyer-section-bottom {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 600px) {
    .mtm-flyer-section-top {
        flex-direction: column;
    }
    .mtm-flyer-block {
        min-width: 100%;
    }
}
