/**
 * AluRail TGV Glassmorphism UI CSS
 * Directly from final mockup.html
 */

/**
 * AluRail TGV Glassmorphism UI CSS
 * Directly from final mockup.html
 */

html {
    margin-top: 0 !important;
}

/* Override WP Admin Bar padding */

:root {
    --blue: #0778AA;
    --purple: #8E74B2;
    --pink: #EE417D;
    --orange: #FBBA5B;
    --dark: #35353C;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --card-bg: rgba(0, 0, 0, 0.05);
    --bg-solid: #ffffff;
    --text-main: #35353C;
    --text-sub: #777;
    --panel-width: 380px;
}

body.dark-mode {
    --glass-bg: rgba(30, 30, 36, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.05);
    --bg-solid: #1e1e24;
    --text-main: #F0F0F0;
    --text-sub: #aaa;
}

body.aluline-public-body,
html.aluline-public-html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    background-color: #1a1a1a;
}

.map-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#aluline-map {
    width: 100%;
    height: 100%;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    color: var(--text-main);
}

/* Top Bar Container */
.top-container {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 1010;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

.branding-panel {
    padding: 12px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: auto;
    width: var(--panel-width);
    flex: 0 0 var(--panel-width);
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

.branding-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-hamburger {
    display: none;
    font-size: 20px;
    color: var(--text-main);
    cursor: pointer;
}

.branding-icon {
    width: 40px;
    height: 40px;
    /*    background: linear-gradient(135deg, var(--blue), var(--purple));*/
    border-radius: 12px;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
}

.branding-title {
    font-family: 'League Spartan', 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
    color: var(--text-main);
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-transform: none !important;
}

.branding-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.switcher-pill {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 3px;
}

body.dark-mode .switcher-pill {
    background: rgba(255, 255, 255, 0.05);
}

.switcher-btn {
    border: none;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 18px;
    cursor: pointer;
    color: var(--text-sub);
    transition: all 0.2s;
    background: transparent;
}

.switcher-btn.active {
    background: white;
    color: var(--blue);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

body.dark-mode .switcher-btn.active {
    background: var(--dark);
    color: #00e5ff;
}

.dropdown-wrapper {
    position: relative;
}

.dropdown-wrapper::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 15px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.user-avatar-img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tgv-expand {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.2s;
}

body.dark-mode .tgv-expand {
    background: rgba(255, 255, 255, 0.05);
}

.tgv-expand:hover {
    background: rgba(7, 120, 170, 0.2);
    color: var(--blue);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 15px;
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 16px;
    padding: 10px 0;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    transform: translateY(-10px);
    z-index: 1001;
}

.dropdown-menu ul,
.dropdown-menu li {
    background: transparent !important;
}

.dropdown-wrapper:hover .dropdown-menu,
.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-main);
    display: block;
    text-decoration: none;
}

.dropdown-item:hover {
    background: rgba(7, 120, 170, 0.1);
    color: var(--blue);
}

.mobile-nav-dropdown {
    display: none !important;
}

.mobile-nav-dropdown.show {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    z-index: 99999 !important;
    padding-top: 60px !important;
    flex-direction: column !important;
    background: var(--bg-solid) !important;
    border: none !important;
}

/* WP Menu Lists compatibility */
.clean-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-dropdown .dropdown-item {
    padding: 18px 25px !important;
    font-size: 16px !important;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-nav-dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.clean-menu li a {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-main);
    display: block;
    text-decoration: none;
}

.clean-menu li a:hover {
    background: rgba(7, 120, 170, 0.1);
    color: var(--blue);
}

.clean-menu li {
    margin: 0;
    padding: 0;
}

.clean-menu li a {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-main);
    display: block;
    text-decoration: none;
}

.clean-menu li a:hover {
    background: rgba(7, 120, 170, 0.1);
    color: var(--blue);
}

/* Top HUD */
.top-hud {
    padding: 12px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.hud-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.hud-stat span {
    color: var(--blue);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--pink);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(238, 65, 125, 0.7);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(238, 65, 125, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(238, 65, 125, 0);
    }
}

/* Floating Backend Message */
.floating-toast {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(251, 186, 91, 0.95);
    color: #fff;
    padding: 12px 20px;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(251, 186, 91, 0.4);
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.toast-close {
    cursor: pointer;
    opacity: 0.8;
}

.toast-close:hover {
    opacity: 1;
}

/* Left Details Panel */
.details-wrapper {
    position: absolute;
    top: 100px;
    left: 20px;
    bottom: 30px;
    width: var(--panel-width);
    z-index: 1000;
    pointer-events: auto;
    display: flex;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.details-wrapper.collapsed {
    transform: translateX(calc(-100% - 20px));
}

.details-panel {
    width: var(--panel-width);
    height: 100%;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.details-panel.train-detail-mode {
    overflow-y: hidden !important;
}

/* Expanded Pane Bento Styles */
.details-wrapper.pane-expanded {
    width: calc(var(--panel-width) * 3);
    max-width: calc(100vw - 60px);
    overflow: visible;
}

/* Expanded pane: col1 = header+tabs+info/jadwal fixed width, col23 = grafik fills rest */
.details-wrapper.pane-expanded .details-panel {
    width: 100%;
    overflow-x: hidden;
}

.details-wrapper.pane-expanded #train-detail-header-wrapper {
    /* header stays full panel width at the top */
    flex-shrink: 0;
}

.details-wrapper.pane-expanded .details-panel.glass {
    background: rgba(255, 255, 255, 0.96);
}

body.dark-mode .details-wrapper.pane-expanded .details-panel.glass {
    background: rgba(30, 30, 36, 0.96);
}

.details-wrapper.pane-expanded #pane-cols-wrapper {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.details-wrapper.pane-expanded #pane-col1 {
    display: flex !important;
    flex-direction: column;
    flex: 0 0 var(--panel-width);
    width: var(--panel-width);
    min-height: 0;
    overflow: hidden;
}

/* Base graphic container (Normal mode) */
.graphic-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: hidden;
    min-width: 0;
}

.details-wrapper.pane-expanded #pane-col23 {
    display: flex !important;
    flex: 1;
    overflow: hidden;
    border-left: 1px solid var(--glass-border);
}

.details-wrapper.pane-expanded #tab-content-graphic {
    flex: 1;
    display: block !important;
    overflow-y: auto;
    padding: 15px;
    height: 100%;
}

/* In expanded mode, graphic content uses flex for stacking */
.details-wrapper.pane-expanded .graphic-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.bento-item {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 10px;
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Row items just stack naturally now */
.bento-curve, .bento-speed, .bento-metro, .bento-elevation, .bento-info {
    width: 100%;
}

/* Metro 2D map container (expanded mode) */
.metro-map-2d {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}
.metro-map-2d svg {
    width: 100%;
    height: 100%;
}

/* ── Global animation keyframes for graphic tab ── */
@keyframes enrouteDot {
    0%, 70%, 100% { opacity: 0; transform: scale(0.5); }
    30%           { opacity: 1; transform: scale(1.4); }
}
@keyframes moveDotsRight {
    from { background-position: 0 0; }
    to   { background-position: 15px 0; }
}
@keyframes moveDotsLeft {
    from { background-position: 15px 0; }
    to   { background-position: 0 0; }
}
@keyframes pulseRing {
    0%   { transform: scale(1); opacity: 0.8; }
    70%  { transform: scale(2.2); opacity: 0; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* Node currently at train position — pulsing glow ring */
.pulsing-node {
    animation: pulseRing 1.8s ease-out infinite !important;
    transform-box: fill-box;
    transform-origin: center;
}

/* En-route dot (animated moving train dot between stops) */
.enroute-dot {
    animation: enrouteDot 3s infinite;
    animation-play-state: running;
}

/* Metro edge line (horizontal bar in single-pane metro) */
.metro-edge {
    transition: background 0.4s ease;
}

/* Make expand tab disappear on mobile */
@media screen and (max-width: 768px) {
    .expand-tab {
        display: none !important;
    }
}

.details-panel.train-detail-mode #panelContent {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: hidden !important;
}

.toggle-tab {
    position: absolute;
    right: -40px;
    top: 50px;
    width: 40px;
    height: 60px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 0 16px 16px 0;
    border-left: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-main);
    font-size: 18px;
    box-shadow: 8px 0 16px rgba(0, 0, 0, 0.1);
}

.search-tab {
    position: absolute;
    right: -40px;
    top: 186px;
    width: 40px;
    height: 60px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 0 16px 16px 0;
    border-left: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--blue);
    font-size: 16px;
    box-shadow: 8px 0 16px rgba(0, 0, 0, 0.1);
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s, color 0.2s;
}

/* When expand tab is hidden (no has-expand-tab), search moves up and share follows */
.details-wrapper:not(.has-expand-tab) .search-tab {
    top: 118px;
}

.details-wrapper:not(.has-expand-tab) .share-tab {
    top: 186px;
}

.expand-tab {
    position: absolute;
    right: -40px;
    top: 118px;
    width: 40px;
    height: 60px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 0 16px 16px 0;
    border-left: none;
    display: flex !important;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-main);
    font-size: 18px;
    box-shadow: 8px 0 16px rgba(0, 0, 0, 0.1);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.details-wrapper.has-expand-tab .expand-tab {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.expand-tab:hover,
.expand-tab.active {
    background: var(--blue);
    color: #fff;
}

.search-tab:hover,
.search-tab.active {
    background: var(--blue);
    color: #fff;
}

.share-tab {
    position: absolute;
    right: -40px;
    top: 254px;
    width: 40px;
    height: 60px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 0 16px 16px 0;
    border-left: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--blue);
    font-size: 20px;
    box-shadow: 8px 0 16px rgba(0, 0, 0, 0.1);
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s, color 0.2s;
}

.share-tab:hover {
    background: var(--blue);
    color: #fff;
}

.share-svg-icon {
    display: block;
    fill: currentColor;
    width: 1.1em;
    height: 1.1em;
}

.share-svg-path {
    fill: currentColor;
}

.mobile-pane-controls {
    display: none;
}

.search-container {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    display: none;
    align-items: center;
    flex-wrap: nowrap;
}

.search-container[style*="display: block"] {
    display: flex !important;
}

.search-container i {
    color: var(--blue);
    font-size: 18px;
}

.search-container input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    margin: 0 15px;
    font-family: 'Outfit';
    font-size: 16px;
    color: var(--text-main);
    font-weight: 500;
}

.sheet-content {
    padding: 5px;
    overflow-y: auto;
    flex: 1;
}

.sheet-content::-webkit-scrollbar {
    display: none;
}

.sheet-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 15px;
}

.btn-full {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: rgba(7, 120, 170, 0.1);
    color: var(--blue);
    border: 1px solid rgba(7, 120, 170, 0.3);
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 15px;
    font-family: 'Outfit';
    box-sizing: border-box;
}

.btn-full:hover {
    background: var(--blue);
    color: white;
}

.list-card {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

body.dark-mode .list-card {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.05);
}

.list-card:hover {
    transform: translateY(-2px);
    border-color: var(--blue);
}

.t-icon {
    width: 44px;
    height: 44px;
    background: rgba(7, 120, 170, 0.15);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--blue);
    margin-right: 15px;
    font-size: 18px;
    flex-shrink: 0;
}

.t-info {
    flex: 1;
}

.t-title {
    font-weight: 700;
    color: var(--text-main);
    font-size: 16px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.t-title>span:first-child {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.t-title .pill {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.t-title .status-green {
    background: rgba(56, 142, 60, 0.1);
    color: #388e3c;
}

.t-title .status-yellow {
    background: rgba(245, 124, 0, 0.1);
    color: #f57c00;
}

.t-title .status-gray {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

.t-route {
    font-size: 12px;
    color: var(--text-sub);
}

.timeline {
    position: relative;
    margin: 20px 0 20px 15px;
    border-left: 2px dashed var(--glass-border);
    padding-left: 20px;
}

.tl-item {
    position: relative;
    margin-bottom: 20px;
}

.tl-station {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin: 2px 0;
    position: relative;
}

.tl-station::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--blue);
    border: 3px solid var(--glass-bg);
    border-radius: 50%;
    z-index: 2;
}

.tl-item.passed .tl-station::before {
    background: #888;
}

.tl-item.active .tl-station::before {
    background: var(--pink);
    box-shadow: 0 0 10px var(--pink);
}

.tl-item.active.stopped .tl-station::before {
    animation: pulse 2s infinite;
}

.tl-time {
    font-size: 12px;
    font-weight: 700;
    color: var(--blue);
}

.enroute-dots {
    position: absolute;
    left: -21px;
    /* Centers the 4px dot over the dashed line */
    top: -45px;
    height: 55px;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    z-index: 1;
}

.enroute-dot {
    width: 4px;
    height: 4px;
    background: var(--pink);
    border-radius: 50%;
    opacity: 0;
}

.enroute-dot.animating {
    animation: enroutePulse 2.5s infinite;
}

.enroute-dot:nth-child(1) {
    animation-delay: 0s;
}

.enroute-dot:nth-child(2) {
    animation-delay: 0.3s;
}

.enroute-dot:nth-child(3) {
    animation-delay: 0.6s;
}

.enroute-dot:nth-child(4) {
    animation-delay: 0.9s;
}

@keyframes enroutePulse {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    15% {
        opacity: 1;
        transform: scale(1.5);
        box-shadow: 0 0 5px var(--pink);
    }

    30% {
        opacity: 0;
        transform: scale(0.5);
    }

    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

.tl-status {
    font-size: 12px;
    color: var(--text-sub);
}

.status-box {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

body.dark-mode .status-box {
    background: rgba(255, 255, 255, 0.05);
}

.status-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--pink);
    display: flex;
    flex-direction: column;
    gap: 5px;
    line-height: 1.4;
}

/* Floating Right Controls */
.controls-container {
    position: absolute;
    right: 20px;
    bottom: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: auto;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.controls-group {
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1vw + 2px, 8px);
    padding: clamp(6px, 1vw + 2px, 8px);
    border-radius: clamp(16px, 1vw + 12px, 20px);
}

.glass-btn {
    width: clamp(36px, 2vw + 28px, 48px);
    height: clamp(36px, 2vw + 28px, 48px);
    border-radius: clamp(10px, 1vw + 6px, 14px);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(14px, 1vw + 10px, 18px);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
    background: transparent;
    border: none;
    outline: none;
}

.glass-btn:hover {
    background: rgba(128, 128, 128, 0.1);
}

.glass-btn:active {
    transform: scale(0.9);
}

.menu-expandable {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: all 0.3s;
}

.menu-expandable.open {
    max-height: 350px;
    opacity: 1;
    overflow: visible;
}

.fab-main {
    background: linear-gradient(135deg, var(--blue), var(--purple));
    color: white;
    border-radius: 16px;
}

.fab-main:hover {
    background: linear-gradient(135deg, var(--blue), var(--purple));
    filter: brightness(1.15);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

#themeModal {
    background: rgba(0, 0, 0, 0.1) !important;
    backdrop-filter: none;
    pointer-events: none; /* Let clicks pass through to the map */
}
#themeModal .modal-content {
    pointer-events: auto; /* Re-enable clicks for the modal itself */
}

@media (max-width: 768px) {
    #themeModal .modal-content {
        max-height: 55vh !important;
        margin-top: auto; /* Align towards bottom so map is visible on top */
        margin-bottom: 20px;
    }
}

.modal-content {
    background: var(--glass-bg) !important;
    color: var(--text-main) !important;
    width: 90%;
    max-width: 420px;
    padding: 25px;
    border-radius: 24px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s;
    max-height: 80vh;
    overflow-y: auto;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal-content::-webkit-scrollbar {
    display: none;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    color: var(--text-sub);
    font-size: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

/* Textarea for Cast */
.cast-textarea {
    width: 100%;
    height: 80px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px;
    font-family: 'Outfit';
    color: var(--text-main);
    resize: none;
    margin-bottom: 10px;
    box-sizing: border-box;
}

body.dark-mode .cast-textarea {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.tc-info {
    font-size: 11px;
    color: var(--text-sub);
    line-height: 1.4;
    margin-bottom: 15px;
}

.tc-info a {
    color: var(--blue);
    text-decoration: underline;
}

.theme-opt {
    padding: 15px;
    border-radius: 12px;
    border: 2px solid var(--glass-border);
    margin-bottom: 10px;
    cursor: pointer;
    background: var(--card-bg);
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.2s;
}

body.dark-mode .theme-opt {
    background: var(--card-bg);
    color: var(--text-main);
}

.theme-opt.active,
.theme-opt:hover {
    border-color: var(--blue) !important;
    background: rgba(7, 120, 170, 0.15) !important;
}

/* Checkbox Switch for Share */
.switch-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 5px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--blue);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.share-btn-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.share-icon-btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-size: 20px;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: none;
}

/* Custom Leaflet Marker Labels (Directional) */
.marker-label-container {
    position: relative;
    width: 0;
    height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-circle {
    background: var(--blue);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 2;
    position: absolute;
    top: 0;
    left: 0;
}

.marker-text {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--glass-border);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--dark);
    white-space: nowrap;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

body.dark-mode .marker-text {
    background: rgba(30, 30, 36, 0.9);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Direksi Text: utara kiri, selatan kanan, barat atas, timur bawah */
.dir-n .marker-text,
.dir-s .marker-text {
    top: 50%;
    transform: translateY(-50%);
}

.dir-n .marker-text {
    right: 14px;
}

.dir-n .live-cast-text {
    right: 22px;
}

.dir-s .marker-text {
    left: 14px;
}

.dir-s .live-cast-text {
    left: 22px;
}

.dir-e .marker-text,
.dir-w .marker-text {
    left: 50%;
    transform: translateX(-50%);
}

.dir-w .marker-text {
    top: 14px;
}

.dir-w .live-cast-text {
    top: 22px;
}

.dir-e .marker-text {
    bottom: 14px;
}

.dir-e .live-cast-text {
    bottom: 22px;
}

/* Marker Label Triangles */
.custom-marker .marker-text::after {
    display: none !important;
}

.train-marker .marker-text::after {
    content: '';
    position: absolute;
    border-style: solid;
    display: block;
    width: 0;
}

.train-marker.dir-n .marker-text::after {
    top: 50%;
    right: -5px;
    margin-top: -5px;
    border-width: 5px 0 5px 5px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.9);
}

body.dark-mode .train-marker.dir-n .marker-text::after {
    border-color: transparent transparent transparent rgba(30, 30, 36, 0.9);
}

.train-marker.dir-s .marker-text::after {
    top: 50%;
    left: -5px;
    margin-top: -5px;
    border-width: 5px 5px 5px 0;
    border-color: transparent rgba(255, 255, 255, 0.9) transparent transparent;
}

body.dark-mode .train-marker.dir-s .marker-text::after {
    border-color: transparent rgba(30, 30, 36, 0.9) transparent transparent;
}

.train-marker.dir-w .marker-text::after {
    top: -5px;
    left: 50%;
    margin-left: -5px;
    border-width: 0 5px 5px 5px;
    border-color: transparent transparent rgba(255, 255, 255, 0.9) transparent;
}

body.dark-mode .train-marker.dir-w .marker-text::after {
    border-color: transparent transparent rgba(30, 30, 36, 0.9) transparent;
}

.train-marker.dir-e .marker-text::after {
    bottom: -5px;
    left: 50%;
    margin-left: -5px;
    border-width: 5px 5px 0 5px;
    border-color: rgba(255, 255, 255, 0.9) transparent transparent transparent;
}

body.dark-mode .train-marker.dir-e .marker-text::after {
    border-color: rgba(30, 30, 36, 0.9) transparent transparent transparent;
}

/* User Cast Marker (Special Train) */
.user-cast-label {
    position: absolute;
    right: 18px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--pink);
    border-radius: 20px 8px 8px 20px;
    padding: 4px 10px 4px 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(238, 65, 125, 0.3);
    z-index: 1;
    white-space: nowrap;
    backdrop-filter: blur(5px);
}

body.dark-mode .user-cast-label {
    background: rgba(30, 30, 36, 0.95);
    border-color: var(--pink);
}

.uc-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--pink);
}

.uc-text {
    display: flex;
    flex-direction: column;
}

.uc-status {
    font-size: 11px;
    font-weight: 700;
    color: var(--pink);
    font-style: italic;
}

.uc-train {
    font-size: 9px;
    color: var(--text-sub);
    font-weight: 600;
}

/* Diagnostic Box */
.diag-box {
    font-family: monospace;
    background: #000;
    color: #0f0;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    font-size: 13px;
    height: 160px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    gap: 8px;
}

/* Tooltips */
.custom-tooltip {
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border) !important;
    backdrop-filter: blur(10px);
    color: var(--text-main) !important;
    border-radius: 8px !important;
    font-family: 'Outfit';
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.tt-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--blue);
    margin-bottom: 2px;
}

.tt-subtitle {
    font-size: 11px;
    color: var(--text-sub);
}

/* --- Splash Screen --- */
#aluline-splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--glass-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-in-out;
    backdrop-filter: blur(10px);
}

.splash-logo-container {
    position: relative;
    width: 150px;
    height: 150px;
}

.splash-logo-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.splash-text-container {
    color: var(--text-sub);
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

.splash-text-container p {
    margin: 0;
}

/* --- Leaflet Popup Overrides --- */
.leaflet-popup-content-wrapper {
    background: var(--glass-bg) !important;
    color: var(--text-main) !important;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.leaflet-popup-content {
    margin: 15px;
    min-width: 280px !important;
}

.leaflet-popup-tip-container {
    display: none;
}

.train-popup h3 {
    margin: 0 0 10px;
    font-size: 16px;
    color: var(--blue);
}

.train-popup p {
    margin: 4px 0;
    font-size: 13px;
}

.train-popup .popup-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.train-popup .popup-actions button {
    flex: 1;
    background: rgba(7, 120, 170, 0.1);
    color: var(--blue);
    border: 1px solid rgba(7, 120, 170, 0.2);
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.train-popup .popup-actions button:hover {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

/* --- Leaflet Control Overrides --- */
.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-control-layers,
.leaflet-control-layers-expanded {
    background-color: var(--glass-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--glass-border) !important;
}

.leaflet-control-layers label {
    color: var(--text-main) !important;
}

.leaflet-control-layers-separator {
    border-top: 1px solid var(--glass-border) !important;
}

body.hide-track-outlines path.track-outline {
    display: none !important;
}

/* RESPONSIVE Adjustments */
@media (max-width: 768px) {
    .top-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        left: 10px;
        right: 10px;
        top: 10px;
        width: calc(100% - 20px);
        box-sizing: border-box;
    }

    .top-container:has(.top-hud.expanded) {
        justify-content: center !important;
    }

    .top-container:has(.top-hud.expanded) .branding-panel {
        display: none !important;
    }

    .branding-panel {
        width: auto;
        flex: 0 0 auto;
        border-radius: 12px;
        padding: 5px 8px;
        margin: 0;
        box-sizing: border-box;
        cursor: pointer;
    }

    .branding-panel .branding-title,
    .branding-panel .branding-right,
    .mobile-hamburger {
        display: none !important;
    }

    .branding-icon {
        margin-right: 0 !important;
    }

    /* Show hamburger on mobile left */
    .mobile-nav-dropdown {
        display: none !important;
    }



    /* Re-enable mobile menu on mobile view */
    .desktop-tgv-menu {
        display: none;
    }

    /* Hide expander on mobile right */
    .desktop-tgv-user {
        display: none;
    }

    /* Hide user avatar on mobile right */

    .floating-toast {
        top: 130px;
        width: calc(100% - 20px);
        box-sizing: border-box;
        font-size: 12px;
        z-index: 3000;
    }

    .top-hud {
        align-self: center;
        width: auto;
        max-width: 100%;
        border-radius: 16px;
        padding: 10px 15px;
        box-sizing: border-box;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 5px;
        transition: all 0.3s ease;
    }

    .hud-stat {
        font-size: 12px;
        white-space: nowrap;
    }

    .search-tab {
        display: none !important;
    }

    .share-tab {
        display: none !important;
    }

    .details-wrapper {
        left: 0;
        bottom: 0;
        width: 100%;
        top: auto;
        height: 50vh;
        transform: translateY(0);
        transition: height 0.4s ease-in-out, transform 0.4s ease-in-out;
        z-index: 1200 !important;
    }

    .details-wrapper.pane-mid {
        height: 50vh;
        transform: translateY(0);
        z-index: 1200 !important;
    }

    .details-wrapper.pane-full {
        height: 100% !important;
        height: 100dvh !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 2500 !important;
        transform: translateY(0) !important;
    }

    .details-wrapper.pane-full .details-panel {
        border-radius: 0 !important;
        height: 100% !important;
        width: 100% !important;
    }

    .details-wrapper.pane-full .search-container {
        padding-right: 125px !important;
        white-space: nowrap;
    }

    .details-wrapper.collapsed {
        transform: translateY(105%) !important;
        height: 50vh;
    }

    .details-wrapper.collapsed .mobile-pane-controls {
        display: none !important;
    }

    .details-panel {
        width: 100%;
        border-radius: 24px 24px 0 0;
    }

    .toggle-tab {
        display: none !important;
    }

    .mobile-pane-controls {
        display: flex !important;
        position: absolute;
        top: -34px;
        right: 20px;
        left: auto;
        width: auto;
        height: 34px;
        align-items: center;
        pointer-events: auto;
        z-index: 3000;
    }

    .mobile-pane-btns-tab {
        height: 34px;
        padding: 0 14px;
        background: var(--glass-bg);
        backdrop-filter: blur(16px);
        border: 1px solid var(--glass-border);
        border-bottom: none;
        border-radius: 14px 14px 0 0;
        display: flex;
        align-items: center;
        gap: 12px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    }

    .mobile-pane-btn {
        width: 28px !important;
        height: 28px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        color: var(--text-main);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        cursor: pointer;
        padding: 0 !important;
    }

    .mobile-back-btn {
        width: auto !important;
        padding: 0 6px !important;
        gap: 6px;
    }

    .mobile-back-btn .back-text {
        font-size: 13px;
        font-weight: 500;
        white-space: nowrap;
    }

    .mobile-pane-divider {
        width: 1px;
        height: 16px;
        background: var(--glass-border);
    }

    .details-wrapper.pane-full .mobile-pane-controls {
        top: 15px !important;
        right: 15px !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        padding: 0 !important;
        z-index: 3500 !important;
    }

    .details-wrapper.pane-full .mobile-pane-btns-tab {
        padding: 0 8px !important;
        height: 40px !important;
        width: auto !important;
        border-radius: 20px !important;
        border: 1px solid var(--glass-border) !important;
        justify-content: center !important;
        gap: 4px !important;
    }

    .details-wrapper.pane-full .mobile-pane-btn {
        width: 32px !important;
        height: 32px !important;
    }

    .details-wrapper.pane-full .mobile-back-btn .back-text {
        display: none !important;
    }

    .details-wrapper.pane-full #mobileMidBtn {
        display: flex !important;
    }

    .details-wrapper.pane-full #mobileExpandBtn,
    .details-wrapper.pane-full .mobile-pane-divider {
        display: none !important;
    }

    .desktop-back-btn {
        display: none !important;
    }

    .controls-container {
        top: auto !important;
        bottom: 25px !important;
        right: 12px;
        z-index: 1100;
        transition: none;
    }

    .details-wrapper.collapsed~.controls-container {
        top: auto !important;
        bottom: 25px !important;
    }

    .details-wrapper.pane-full~.controls-container {
        display: none !important;
    }

    .details-panel {
        overflow-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .details-panel::-webkit-scrollbar {
        display: none;
    }

    .sheet-content {
        overflow-y: visible;
        flex: none;
        height: auto;
        overflow: hidden;
    }

    .mobile-floating-pane-container {
        position: fixed;
        left: 16px;
        bottom: 25px;
        z-index: 1050;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .mobile-float-btn {
        width: 48px !important;
        height: 48px !important;
        border-radius: 14px !important;
        background: var(--glass-bg) !important;
        backdrop-filter: blur(16px);
        border: 1px solid var(--glass-border) !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-main);
        font-size: 18px;
        cursor: pointer;
    }

    @keyframes alulinePulseAttention {
        0% {
            transform: scale(1);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        }

        50% {
            transform: scale(1.05);
            box-shadow: 0 6px 22px rgba(255, 107, 0, 0.45);
            border-color: var(--orange);
        }

        100% {
            transform: scale(1);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        }
    }

    .mobile-float-tooltip {
        padding: 10px 16px;
        border-radius: 20px;
        background: var(--glass-bg);
        backdrop-filter: blur(16px);
        border: 1px solid var(--glass-border);
        font-size: 13px;
        font-weight: 600;
        color: var(--text-main);
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        white-space: nowrap;
        animation: alulinePulseAttention 1.2s infinite ease-in-out;
    }

    #mobileSearchBtn {
        position: fixed;
        left: 16px;
        bottom: 85px;
        z-index: 1050;
        transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    }

    .aluline-map-watermark {
        bottom: 38px !important;
        width: calc(100% - 80px);
        max-width: 550px;
        white-space: normal !important;
        line-height: 1.35;
        font-size: 9.5px;
    }
}

.leaflet-tooltip-top:before {
    border-top-color: var(--glass-bg) !important;
}

.leaflet-tooltip-bottom:before {
    border-bottom-color: var(--glass-bg) !important;
}

.leaflet-tooltip-left:before {
    border-left-color: var(--glass-bg) !important;
}

.leaflet-tooltip-right:before {
    border-right-color: var(--glass-bg) !important;
}

.aluline-btn {
    padding: 8px 15px;
    border-radius: 8px;
    font-family: 'Outfit';
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: var(--blue);
    color: white;
    transition: all 0.2s;
}

.aluline-btn:hover {
    background: #065b82;
}

.aluline-btn-outline {
    background: transparent;
    border: 1px solid var(--blue);
    color: var(--blue);
}

.aluline-btn-outline:hover {
    background: var(--blue);
    color: white;
}

/* Hide Leaflet tooltip triangle to match dark/light theme */
.custom-tooltip::before {
    display: none !important;
}

.train-marker:hover .marker-text,
.train-marker.active-marker .marker-text {
    opacity: 0 !important;
}

/* Watermark & Footer Styles */
.aluline-map-watermark {
    position: absolute;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    opacity: 0.3;
    font-size: 11px;
    text-align: center;
    color: var(--text-main);
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

body.dark-mode .aluline-map-watermark {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.aluline-socials-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.aluline-social-link {
    display: inline-block;
    transition: transform 0.2s;
}

.aluline-social-link:hover {
    transform: scale(1.1);
}

.aluline-social-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

/* Dark Mode Leaflet Popups and Controls */
body.dark-mode .leaflet-popup-content-wrapper,
body.dark-mode .leaflet-popup-tip {
    background: #35353C;
    color: #f0f0f0;
}

body.dark-mode .train-popup h3 {
    color: #00e5ff;
}

body.dark-mode .leaflet-control-layers,
body.dark-mode .leaflet-control-layers-expanded,
body.dark-mode .leaflet-bar,
body.dark-mode .leaflet-bar a,
body.dark-mode .leaflet-control {
    background-color: #35353C;
    color: #f0f0f0;
    border-color: #555;
}

body.dark-mode .leaflet-bar a:hover {
    background-color: #444;
}

body.dark-mode .leaflet-control-layers-separator {
    border-top: 1px solid #555;
}

body.dark-mode .modal-content h1,
body.dark-mode .modal-content h2,
body.dark-mode .modal-content h3,
body.dark-mode .modal-content h4,
body.dark-mode .modal-content h5,
body.dark-mode .modal-content h6,
body.dark-mode .modal-title {
    color: white !important;
}


@keyframes moveArrowsRight {
    0% {
        transform: translateX(-50%);
    }

    100% {
        transform: translateX(0%);
    }
}

.t-title-scroll::-webkit-scrollbar {
    display: none;
}

.smooth-arrow-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 12px;
    position: relative;
    overflow: hidden;
}

.smooth-arrow {
    position: absolute;
    width: 6px;
    height: 6px;
    border-top: 1.5px solid var(--text-sub);
    border-right: 1.5px solid var(--text-sub);
    transform: rotate(45deg) translate(-10px, 10px);
    animation: smoothArrowAnim 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.smooth-arrow:nth-child(2) {
    animation-delay: -1s;
}

@keyframes smoothArrowAnim {
    0% {
        opacity: 0;
        transform: rotate(45deg) translate(-10px, 10px);
    }

    30% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: rotate(45deg) translate(10px, -10px);
    }
}

/* ============================================================
   SPLASH SCREEN — 1:1 match with map_splash_mockup.html
   ============================================================ */

/* Splash-specific CSS variables (mirroring mockup's --accent-color, --text-primary, etc.) */
:root {
    --splash-accent: #1a73e8;
    --splash-text-primary: #1f1f1f;
    --splash-text-secondary: #5f6368;
    --splash-bg: #ffffff;
    --splash-line-color: 150, 150, 150;
}

/* Dark mode: stored preference via body class (set by initUiTheme before splash renders) */
body.dark-mode {
    --splash-accent: #8ab4f8;
    --splash-text-primary: #f1f3f4;
    --splash-text-secondary: #9aa0a6;
    --splash-bg: #0d0e12;
    --splash-line-color: 200, 200, 200;
}

#aluline-splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--splash-bg);
    color: var(--splash-text-primary);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: opacity 1.2s ease, visibility 1.2s ease;
    overflow: hidden;
    box-sizing: border-box;
}

#aluline-splash-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    display: block;
}

.splash-content-wrapper {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 24px;
    box-sizing: border-box;
}

#aluline-splash-heading {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 3.5rem;
    font-weight: 500;
    line-height: 1.1;
    margin: 0 0 1rem 0;
    letter-spacing: -1.5px;
    color: var(--splash-text-primary);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#aluline-splash-subheading {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.15rem;
    color: var(--splash-text-secondary);
    margin: 0 0 3rem 0;
    max-width: 700px;
    line-height: 1.5;
    transition: opacity 0.5s ease;
}

/* --- Dot-floating loader (1:1 from mockup) --- */
.splash-loader-container {
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2.5rem;
    width: 120px;
    overflow: hidden;
    transition: opacity 0.5s ease;
}

.dot-floating {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background-color: var(--splash-accent);
    animation: aluline-dot-floating 3s infinite cubic-bezier(0.15, 0.6, 0.9, 0.1);
}

.dot-floating::before,
.dot-floating::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background-color: var(--splash-accent);
}

.dot-floating::before {
    animation: aluline-dot-floating-before 3s infinite ease-in-out;
}

.dot-floating::after {
    animation: aluline-dot-floating-after 3s infinite cubic-bezier(0.4, 0, 1, 1);
}

@keyframes aluline-dot-floating {
    0% {
        transform: translateX(-60px);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    75% {
        transform: translateX(60px);
        opacity: 1;
    }

    85% {
        opacity: 0;
    }

    100% {
        transform: translateX(60px);
        opacity: 0;
    }
}

@keyframes aluline-dot-floating-before {
    0% {
        transform: translateX(-60px);
    }

    50% {
        transform: translateX(-14px);
    }

    75% {
        transform: translateX(-60px);
    }

    100% {
        transform: translateX(-60px);
    }
}

@keyframes aluline-dot-floating-after {
    0% {
        transform: translateX(-60px);
    }

    50% {
        transform: translateX(14px);
    }

    75% {
        transform: translateX(60px);
    }

    100% {
        transform: translateX(60px);
    }
}

/* --- Disclaimer small text --- */
.splash-disclaimer {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.85rem;
    color: var(--splash-text-secondary);
    max-width: 500px;
    opacity: 0.7;
    transition: opacity 0.5s ease;
    line-height: 1.4;
}

/* Fade-out state applied by JS (matches mockup's opacity+visibility transition) */
#aluline-splash-screen.splash-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 768px) {
    #aluline-splash-heading {
        font-size: 2.5rem;
        letter-spacing: -1px;
    }

    #aluline-splash-subheading {
        font-size: 1rem;
    }

    .splash-content-wrapper {
        padding: 1.5rem;
    }
}



/* ============================================================
 * v0.6.0.5  Tab Resume Overlay (#aluline-resuming-overlay)
 * ============================================================ */

#aluline-resuming-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px) brightness(0.7);
    -webkit-backdrop-filter: blur(10px) brightness(0.7);
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

#aluline-resuming-overlay.aro-show {
    opacity: 1;
    pointer-events: auto;
}

.aro-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 32px 48px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body:not(.dark-mode) .aro-inner {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(0, 0, 0, 0.08);
}

.aro-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: #0778AA;
    border-radius: 50%;
    animation: aro-spin 0.9s linear infinite;
}

body:not(.dark-mode) .aro-spinner {
    border-color: rgba(7, 120, 170, 0.2);
    border-top-color: #0778AA;
}

@keyframes aro-spin {
    to {
        transform: rotate(360deg);
    }
}

.aro-text {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.02em;
    text-align: center;
}

body:not(.dark-mode) .aro-text {
    color: var(--dark, #35353C);
}

/* v0.6.0.5  Search clear (X) button */
#search-clear-btn {
    opacity: 0.6;
    transition: opacity 0.15s, color 0.15s;
}

#search-clear-btn:hover {
    opacity: 1;
    color: #e74c3c !important;
}

/* Hide scrollbars globally for detail panes */
#panelContent,
#tab-content-info,
#tab-content-schedule,
#stationTimetableContainer,
.details-panel,
.timeline {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#panelContent::-webkit-scrollbar,
#tab-content-info::-webkit-scrollbar,
#tab-content-schedule::-webkit-scrollbar,
#stationTimetableContainer::-webkit-scrollbar,
.details-panel::-webkit-scrollbar,
.timeline::-webkit-scrollbar {
    display: none;
}

.details-panel,
#panelContent,
#tab-content-graphic,
.metro-scroll-container,
.graphic-scroll-container,
.speed-scroll-container {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

/* Constrain scroll containers to parent width — prevents bento items from
   expanding to the inner profile (e.g. 600px) width and overflowing the panel */
.metro-scroll-container,
.graphic-scroll-container,
.speed-scroll-container {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.details-panel::-webkit-scrollbar,
#panelContent::-webkit-scrollbar,
#tab-content-graphic::-webkit-scrollbar,
.metro-scroll-container::-webkit-scrollbar,
.graphic-scroll-container::-webkit-scrollbar,
.speed-scroll-container::-webkit-scrollbar {
    display: none !important;
}

.map-theme-bg {
    background-size: cover;
    background-position: center;
    color: white !important;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 5px rgba(0, 0, 0, 0.8);
    height: 60px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 5px;
    box-shadow: inset 0 -25px 20px -10px rgba(0, 0, 0, 0.8);
    border: 2px solid transparent;
}

.map-theme-bg.active,
.map-theme-bg:hover {
    border-color: var(--blue) !important;
}

@media (min-width: 769px) {
    .aluline-mobile-only {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .aluline-desktop-only {
        display: none !important;
    }
}

@media (max-width: 768px) {
    #themeModalBody {
        overflow-y: auto !important;
    }

    #themeListContainer {
        max-height: none !important;
        overflow-y: visible !important;
    }

    #themePreviewContainer {
        margin-bottom: 20px;
    }
}

/* ============================================================
   ALU-TOOLTIP — Custom hover tooltip system (desktop only)
   v0.6.1.0 — overrides native browser title tooltips
   ============================================================ */
@media (min-width: 769px) {

    .glass-btn[data-alu-tip],
    .hud-stat[data-alu-tip],
    .top-hud[data-alu-tip] {
        position: relative;
    }

    /* Tooltip bubble */
    [data-alu-tip]::after {
        content: attr(data-alu-tip);
        position: absolute;
        white-space: nowrap;
        width: max-content;
        pointer-events: none;
        z-index: 9999;
        font-family: 'Outfit', 'Inter', sans-serif;
        font-size: 12px;
        font-weight: 500;
        line-height: 1.3;
        padding: 5px 10px;
        border-radius: 8px;
        background: var(--glass-bg, rgba(20, 20, 30, 0.94));
        color: var(--text-main, #f0f0f0);
        border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        opacity: 0;
        transition: opacity 0.15s ease, transform 0.15s ease;
    }

    /* Arrow base */
    [data-alu-tip]::before {
        content: '';
        position: absolute;
        pointer-events: none;
        z-index: 10000;
        border: 5px solid transparent;
        opacity: 0;
        transition: opacity 0.15s ease;
    }

    [data-alu-tip]:hover::after,
    [data-alu-tip]:hover::before {
        opacity: 1;
    }

    /* ── LEFT placement (bubble appears LEFT of element, arrow → points right toward button) ── */
    /* Default for controls-group buttons on the right side of screen */
    [data-alu-tip]:not([data-alu-tip-pos])::after,
    [data-alu-tip][data-alu-tip-pos="left"]::after {
        right: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%) translateX(6px);
    }

    [data-alu-tip]:not([data-alu-tip-pos]):hover::after,
    [data-alu-tip]:hover[data-alu-tip-pos="left"]::after {
        transform: translateY(-50%) translateX(0);
    }

    [data-alu-tip]:not([data-alu-tip-pos])::before,
    [data-alu-tip][data-alu-tip-pos="left"]::before {
        right: calc(100% + 4px);
        top: 50%;
        transform: translateY(-50%);
        border-left-color: var(--glass-bg, rgba(20, 20, 30, 0.94));
        border-right-width: 0;
    }

    /* ── RIGHT placement (bubble appears RIGHT of element, arrow ← points left toward tab) ── */
    /* For toggle-tab / search-tab / share-tab on left side of screen */
    [data-alu-tip][data-alu-tip-pos="right"]::after {
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%) translateX(-6px);
    }

    [data-alu-tip]:hover[data-alu-tip-pos="right"]::after {
        transform: translateY(-50%) translateX(0);
    }

    [data-alu-tip][data-alu-tip-pos="right"]::before {
        left: calc(100% + 4px);
        top: 50%;
        transform: translateY(-50%);
        border-right-color: var(--glass-bg, rgba(20, 20, 30, 0.94));
        border-left-width: 0;
    }

    /* ── BOTTOM placement (bubble appears BELOW, arrow ↑ points up) ── */
    /* For HUD bar */
    [data-alu-tip][data-alu-tip-pos="bottom"]::after {
        top: calc(100% + 10px);
        left: 50%;
        transform: translateX(-50%) translateY(-6px);
    }

    [data-alu-tip]:hover[data-alu-tip-pos="bottom"]::after {
        transform: translateX(-50%) translateY(0);
    }

    [data-alu-tip][data-alu-tip-pos="bottom"]::before {
        top: calc(100% + 4px);
        left: 50%;
        transform: translateX(-50%);
        border-bottom-color: var(--glass-bg, rgba(20, 20, 30, 0.94));
        border-top-width: 0;
    }

    /* Light mode — glassmorphism light override */
    body[data-ui-theme="light"] [data-alu-tip]::after,
    body.ui-light [data-alu-tip]::after {
        background: rgba(255, 255, 255, 0.97);
        color: #1a1a2e;
        border-color: rgba(0, 0, 0, 0.08);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    }

    body[data-ui-theme="light"] [data-alu-tip]::before,
    body.ui-light [data-alu-tip]::before {
        border-color: transparent;
    }

    body[data-ui-theme="light"] [data-alu-tip]::before,
    body.ui-light [data-alu-tip][data-alu-tip-pos="left"]::before,
    body.ui-light [data-alu-tip]:not([data-alu-tip-pos])::before {
        border-left-color: rgba(255, 255, 255, 0.97);
    }

    body[data-ui-theme="light"] [data-alu-tip][data-alu-tip-pos="right"]::before,
    body.ui-light [data-alu-tip][data-alu-tip-pos="right"]::before {
        border-right-color: rgba(255, 255, 255, 0.97);
    }

    body[data-ui-theme="light"] [data-alu-tip][data-alu-tip-pos="bottom"]::before,
    body.ui-light [data-alu-tip][data-alu-tip-pos="bottom"]::before {
        border-bottom-color: rgba(255, 255, 255, 0.97);
    }
}

/* --- Track Layer System & Theme Modal Tabs --- */
.theme-tab-btn {
    outline: none;
    user-select: none;
}

.theme-tab-btn.active {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--blue) !important;
    color: #fff !important;
    box-shadow: 0 0 12px rgba(0, 176, 255, 0.3);
}

.theme-tab-btn:hover:not(.active) {
    background: rgba(7, 120, 170, 0.1) !important;
    color: var(--text-main) !important;
}

.layer-toggle-box {
    transition: all 0.2s ease;
    cursor: pointer;
}

.layer-toggle-box:hover {
    border-color: var(--blue) !important;
    background: rgba(7, 120, 170, 0.1) !important;
}

.layer-toggle-box.active {
    border-color: var(--blue) !important;
    background: rgba(7, 120, 170, 0.18) !important;
    box-shadow: 0 0 12px rgba(0, 176, 255, 0.2);
}

/* Running LED Animation for Dynamic Route Trail */
.led-running-track,
path.led-running-track,
svg path.led-running-track {
    stroke-dasharray: 20, 300 !important;
    stroke-linecap: round !important;
    animation: alu-led-march 2.5s linear infinite !important;
    filter: drop-shadow(0 0 5px #6ee7b7);
}

@keyframes alu-led-march {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: -320;
    }
}

@media (max-width: 768px) {
    #themeModalBody {
        overflow-y: auto !important;
        flex-direction: column !important;
    }

    #themeListContainer {
        max-height: none !important;
        overflow-y: visible !important;
    }

    #themePreviewContainer {
        display: none !important;
    }
}

.theme-tab-btn.active {
    background: var(--blue) !important;
    border-color: var(--blue) !important;
    color: #fff !important;
    box-shadow: 0 0 12px rgba(0, 176, 255, 0.3);
}
@media (max-width: 1200px) {
    .details-wrapper.pane-expanded .graphic-container {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto auto auto !important;
        overflow-y: auto !important;
    }
    .bento-curve, .bento-speed, .bento-metro, .bento-elevation, .bento-info {
        grid-column: 1 !important;
        grid-row: auto !important;
    }
}

/* Train Loader */
.train-loader-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}
.train-loader {
    width: 50px;
    height: 50px;
    animation: rotate-loader 2s linear infinite;
}
.loader-track {
    stroke: currentColor;
    opacity: 0.1;
}
.loader-train {
    stroke: var(--blue, #007aff);
    stroke-dasharray: 10 5 10 5 15 100;
    animation: move-train 1.5s linear infinite;
    stroke-linecap: round;
}
@keyframes rotate-loader {
    100% { transform: rotate(360deg); }
}
@keyframes move-train {
    0% { stroke-dashoffset: 125; }
    100% { stroke-dashoffset: 0; }
}

@keyframes alu-bounce-shake {
    0%, 90% { transform: translateY(0) rotate(0); }
    92% { transform: translateY(-10px) rotate(-10deg); }
    94% { transform: translateY(0) rotate(10deg); }
    96% { transform: translateY(-5px) rotate(-5deg); }
    98% { transform: translateY(0) rotate(5deg); }
    100% { transform: translateY(0) rotate(0); }
}

@keyframes alu-label-attention {
    0%, 90% { transform: translateY(-50%) translateX(0); }
    92% { transform: translateY(-50%) translateX(-8px) scale(1.05); }
    94% { transform: translateY(-50%) translateX(5px) scale(1.05); }
    96% { transform: translateY(-50%) translateX(-4px) scale(1.05); }
    98% { transform: translateY(-50%) translateX(2px) scale(1.05); }
    100% { transform: translateY(-50%) translateX(0) scale(1); }
}


@media (max-width: 768px) {
    #detailsWrapper.pane-mid.graphic-tab-active .dp-header-buttons {
        display: none !important;
    }
    #detailsWrapper.pane-mid.graphic-tab-active .dp-header-title-container {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }
    #detailsWrapper.pane-mid.graphic-tab-active .dp-header-name {
        margin-bottom: 0 !important;
    }
    #detailsWrapper.pane-full .dp-header-buttons {
        display: none !important;
    }
}

/* ============================================================
 * MOBILE LANDSCAPE — Orientation layout adjustments
 * Applies when device is short (≤500px height) and landscape
 * Purely additive — does NOT override or remove any existing rules
 * ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {

    /* 1. TOP BAR — compact single row */
    .top-container {
        flex-direction: row !important;
        gap: 8px;
        top: 6px;
        left: 8px;
        right: 8px;
        align-items: center;
    }

    /* Branding: collapsed (logo-only) by default di landscape */
    .branding-panel {
        width: auto !important;
        flex: 0 0 auto !important;
        padding: 5px 8px !important;
        border-radius: 12px !important;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    /* Sembunyikan title, lang switcher, user menu, chevron saat collapsed */
    .branding-panel .branding-title,
    .branding-panel .branding-right {
        display: none !important;
        overflow: hidden !important;
        max-width: 0 !important;
        opacity: 0;
        transition: all 0.3s ease;
    }

    /* HUD: collapsed by default di landscape (hanya baris utama) */
    .top-hud {
        flex-shrink: 0 !important;
        padding: 5px 10px !important;
        border-radius: 12px !important;
        font-size: 11px !important;
        gap: 6px !important;
        cursor: pointer;
    }

    /* Paksa HUD selalu collapsed di landscape (extend inline style @media) */
    @media (max-height: 500px) and (orientation: landscape) {
        .top-hud:not(.expanded) .hud-extra-stats { display: none !important; }
        .top-hud.expanded .hud-extra-stats { display: flex !important; }
        #hudExpandIcon { display: inline-block !important; }
    }

    .branding-title {
        font-size: 14px;
    }

    /* 2. DETAILS WRAPPER — floating side panel kiri, seperti desktop */
    .details-wrapper {
        left: 20px !important;
        top: 60px !important;
        bottom: 10px !important;
        width: 265px !important;
        height: auto !important;
        transform: none !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        border-radius: 24px !important;
        overflow: visible !important;
    }

    /* Collapsed: slide ke kiri termasuk offset margin */
    .details-wrapper.collapsed {
        transform: translateX(calc(-100% - 20px)) !important;
    }

    /* pane-mid / pane-full → reset ke floating side panel */
    .details-wrapper.pane-mid,
    .details-wrapper.pane-full {
        width: 265px !important;
        height: auto !important;
        top: 60px !important;
        bottom: 10px !important;
        left: 20px !important;
        transform: none !important;
        z-index: 1200 !important;
    }

    /* details-panel: pertahankan border-radius floating */
    .details-panel {
        width: 100% !important;
        border-radius: 24px !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    /* Content tabs: pastikan bisa scroll dan mengisi tinggi pane */
    #pane-col1 {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    #train-detail-header-wrapper {
        flex-shrink: 0 !important;
    }

    #tab-content-info,
    #tab-content-schedule,
    #tab-content-graphic {
        overflow-y: auto !important;
        flex: 1 !important;
        min-height: 0 !important;
    }

    #panelContent {
        overflow-y: auto !important;
        flex: 1 !important;
        min-height: 0 !important;
        height: 100% !important;
    }

    /* 3. MOBILE PANE CONTROLS — sembunyikan, pakai toggle-tab */
    .mobile-pane-controls {
        display: none !important;
    }

    /* 4. TOGGLE TAB — sesuaikan posisi dengan floating pane menggunakan variable */
    .details-wrapper {
        --tab-top: 60px;
    }

    .toggle-tab, .expand-tab, .search-tab, .share-tab {
        width: 28px !important;
        height: 42px !important;
        right: -28px !important;
        font-size: 14px !important;
        display: flex !important;
    }

    .toggle-tab { top: var(--tab-top) !important; }
    .expand-tab { top: calc(var(--tab-top) + 52px) !important; }
    .search-tab { top: calc(var(--tab-top) + 104px) !important; }
    .share-tab { top: calc(var(--tab-top) + 156px) !important; }

    .details-wrapper:not(.has-expand-tab) .search-tab { top: calc(var(--tab-top) + 52px) !important; }
    .details-wrapper:not(.has-expand-tab) .share-tab { top: calc(var(--tab-top) + 104px) !important; }


    /* 6. CONTROLS CONTAINER — kanan bawah, column */
    .controls-container {
        bottom: 10px !important;
        right: 10px !important;
        top: auto !important;
        gap: 6px !important;
        flex-direction: column !important;
        align-items: flex-end !important;
    }

    /* Zoom group: column flow */
    .controls-group:has(#zoomInBtn) {
        flex-direction: column !important;
    }

    /* Prevent android button from centering when controls container expands */
    #downloadAppBtn {
        margin: 0 0 10px 0 !important;
    }

    /* 6b. MENU EXPANDABLE — expand horizontal ke kiri, ⋮ di kanan */
    .controls-group:has(#expandMenuBtn) {
        flex-direction: row !important;
        align-items: center !important;
    }

    #expandableMenu {
        flex-direction: row !important;
        max-height: none !important;
        max-width: 0 !important;
        opacity: 0 !important;
        overflow: hidden !important;
        transition: max-width 0.3s ease, opacity 0.3s ease !important;
        gap: 4px !important;
    }

    #expandableMenu.open {
        max-width: 260px !important;
        opacity: 1 !important;
        overflow: visible !important;
    }

    /* 7. FLOATING MOBILE BUTTONS — hidden (ada toggle-tab) */
    #mobileSearchBtn,
    .mobile-floating-pane-container {
        display: none !important;
    }

    /* 8. FLOATING TOAST — sesuaikan posisi */
    .floating-toast {
        top: 60px;
        font-size: 11px;
        padding: 8px 14px;
    }

    /* 9. WATERMARK — agar tidak tertutup controls */
    .aluline-map-watermark {
        bottom: 28px !important;
        font-size: 9px;
    }

    /* 10. SPLASH SCREEN — scale down teks */
    #aluline-splash-heading {
        font-size: 2rem;
        letter-spacing: -0.5px;
    }

    #aluline-splash-subheading {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .splash-content-wrapper {
        padding: 1rem;
    }

    /* 11. CONTROLS GROUP — glass-btn lebih kecil */
    .controls-container {
        gap: 6px !important;
    }

    .controls-group {
        gap: 4px !important;
        padding: 5px !important;
        border-radius: 12px !important;
    }

    .glass-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
    }

    /* 12. TRAIN DETAIL HEADER — satu baris kompak */

    /* Wrapper: flex row + wrap agar tabs bisa turun baris */
    #train-detail-header-wrapper {
        padding: 5px 8px 0 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 5px !important;
        flex-wrap: wrap !important;
    }

    /* Back button — square and compact */
    #train-detail-header-wrapper .btn-full.desktop-back-btn {
        flex-shrink: 0 !important;
        width: 24px !important;
        min-width: 24px !important;
        max-width: 24px !important;
        height: 24px !important;
        padding: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 4px !important;
        overflow: hidden !important;
    }

    #train-detail-header-wrapper .btn-full.desktop-back-btn i {
        font-size: 13px !important;
        display: block !important;
    }

    /* Section title — ambil sisa ruang, reset inline style */
    #train-detail-header-wrapper .section-title {
        flex: 1 !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    /* Inner flex row di section-title: nowrap */
    #train-detail-header-wrapper .section-title > div {
        flex-wrap: nowrap !important;
        gap: 4px !important;
        align-items: center !important;
    }

    /* Title container: ubah dari column → row */
    #train-detail-header-wrapper .dp-header-title-container {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 4px !important;
        flex: 1 !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    /* Nama kereta: kecil, 1 baris, ellipsis */
    #train-detail-header-wrapper .dp-header-name {
        font-size: 11px !important;
        font-weight: 700 !important;
        margin-bottom: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 90px !important;
        line-height: 1.2 !important;
        word-break: normal !important;
    }

    /* Stats: 1 baris, no wrap, kecil */
    #train-detail-header-wrapper .dp-header-stats {
        display: flex !important;
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
        gap: 3px !important;
        align-items: center !important;
        font-size: 10px !important;
    }

    #train-detail-header-wrapper .dp-header-stats span {
        font-size: 10px !important;
        padding: 1px 4px !important;
    }

    /* Follow + GPS button */
    #train-detail-header-wrapper .dp-header-buttons {
        display: flex !important;
        gap: 3px !important;
        flex-shrink: 0 !important;
    }

    #train-detail-header-wrapper .dp-header-buttons button {
        padding: 4px 8px !important;
        font-size: 12px !important;
        border-radius: 5px !important;
    }

    /* Train tabs: full-width, ke baris ke-2 */
    #train-detail-header-wrapper ul.train-tabs {
        flex-basis: 100% !important;
        width: 100% !important;
        margin: 2px 0 0 0 !important;
        padding: 0 !important;
    }

    #train-detail-header-wrapper ul.train-tabs li {
        padding: 5px 2px !important;
        font-size: 11px !important;
    }

    /* 13. PANE OPEN — sembunyikan branding, naikkan pane ke ujung atas */
    body:has(.details-wrapper:not(.collapsed)) .branding-panel {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: scale(0.8) !important;
        transition: opacity 0.2s, transform 0.2s !important;
    }

    body:has(.details-wrapper:not(.collapsed)) .details-wrapper {
        top: 25px !important;
        --tab-top: 25px;
    }

    body:has(.details-wrapper.pane-expanded) .details-wrapper {
        --tab-top: 70px;
    }

    body:has(.details-wrapper.pane-expanded) .controls-group:has(#zoomInBtn),
    body:has(.details-wrapper.pane-expanded) #downloadAppBtn {
        display: none !important;
    }



    /* Pastikan pane mengisi ruang dengan benar: override --panel-width di landscape */
    .details-wrapper:not(.collapsed) {
        --panel-width: 265px !important;
    }

    /* details-panel: flex column, fill full height */
    .details-panel {
        display: flex !important;
        flex-direction: column !important;
    }

    /* 14. ANIMATION LOG — hide ketika HUD collapsed */
    .top-hud:not(.expanded) .anim-debug-only {
        display: none !important;
    }
    .top-hud.expanded .anim-debug-only {
        display: flex !important;
    }

    /* Zoom group tidak melebar */
    .controls-group:not(:has(#expandMenuBtn)) {
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        flex-shrink: 0 !important;
    }

    .controls-group:not(:has(#expandMenuBtn)) .glass-btn {
        width: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
        flex-shrink: 0 !important;
    }

    /* 16. PANE CONTENT — font lebih kecil di landscape */
    #panelContent,
    #tab-content-info,
    #tab-content-schedule {
        font-size: 12px !important;
    }

    #panelContent p,
    #panelContent div,
    #tab-content-info p,
    #tab-content-info div {
        font-size: 12px !important;
    }

    /* 17. HIDE distance + duration pills di header landscape */
    #train-detail-header-wrapper .dp-header-stats {
        display: none !important;
    }

    /* 18. PANE-EXPANDED di landscape — full width (memanfaatkan seluruh lebar layar) */
    .details-wrapper.pane-expanded {
        left: 20px !important;
        right: 60px !important;
        width: auto !important;
        max-width: none !important;
        top: 8px !important;
        bottom: 8px !important;
        --panel-width: 200px !important;
    }

    .details-wrapper.pane-expanded .details-panel {
        width: 100% !important;
    }

    .details-wrapper.pane-expanded #pane-cols-wrapper {
        flex-direction: row !important;
        height: 100% !important;
    }

    .details-wrapper.pane-expanded #pane-col1 {
        flex: 0 0 200px !important;
        width: 200px !important;
        min-width: 0 !important;
    }

    .details-wrapper.pane-expanded #pane-col23 {
        flex: 1 !important;
        min-width: 0 !important;
        height: 100% !important;
        overflow-y: auto !important;
    }
}

/* Nav Mode Oversized Container */
#aluline-map.nav-mode-active {
    width: 150vmax !important;
    height: 150vmax !important;
    top: 50% !important;
    left: 50% !important;
    margin-top: -75vmax !important;
    margin-left: -75vmax !important;
    position: absolute !important;
    transition: transform 0.1s linear;
}

/* Hide overflow of map area */
.map-area {
    overflow: hidden !important;
}

/* ─── OVERFLOW FIXES ────────────────────────────────────────────── */

/* Trip progress bar & segment text: prevent horizontal overflow inside panel content */
.details-panel.train-detail-mode #panelContent,
.details-panel #panelContent {
    overflow-x: hidden;
}

/* Tab-content areas: clip horizontal overflow in non-expanded (single-column) mode */
.details-wrapper:not(.pane-expanded) #tab-content-info,
.details-wrapper:not(.pane-expanded) #tab-content-schedule,
.details-wrapper:not(.pane-expanded) #tab-content-graphic {
    overflow-x: hidden;
}

/* Graphic tab in single-column mode: prevent horizontal overflow */
.details-wrapper:not(.pane-expanded) #tab-content-graphic {
    overflow-x: hidden !important;
}

/* Route overview and bento items: limit to panel width in single-column */
.details-wrapper:not(.pane-expanded) .graphic-container,
.details-wrapper:not(.pane-expanded) .bento-item,
.details-wrapper:not(.pane-expanded) .metro-map-2d {
    max-width: 100%;
    overflow-x: hidden;
}

/* ─── PANE RIGHT EDGE FIX ───────────────────────────────────────── */

/* Ensure side tabs connect smoothly with the panel right edge */
.toggle-tab,
.search-tab,
.share-tab,
.expand-tab {
    /* Slight left gap so tab visually connects with panel border-radius */
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

/* Smooth right edge transition by ensuring panel right side uses consistent radius */
.details-wrapper:not(.pane-expanded) .details-panel {
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
}


/* ==========================================================================
   TUTORIAL OVERLAY
   ========================================================================== */

#alurail-tutorial-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    pointer-events: none;
}

#alurail-tutorial-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#alurail-tutorial-cutout {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.alurail-tutorial-dialog {
    position: absolute;
    width: 300px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    color: var(--text-main);
    pointer-events: auto;
    transition: top 0.5s cubic-bezier(0.4, 0, 0.2, 1), left 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    opacity: 0;
    transform: translateY(10px);
    animation: tutorialSlideIn 0.5s forwards;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@keyframes tutorialSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alurail-tutorial-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
}

.alurail-tutorial-text {
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.4;
}

.alurail-tutorial-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.alurail-tutorial-btn {
    background: none;
    border: none;
    color: var(--text-sub);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.alurail-tutorial-btn:hover {
    background: var(--hover-bg);
    color: var(--text-main);
}

.alurail-tutorial-btn-primary {
    background: var(--blue);
    color: #fff;
    padding: 8px 16px;
}

.alurail-tutorial-btn-primary:hover {
    background: #1d4ed8;
    color: #fff;
}



/* ============================================================
 * NEARBY TRAINS UI
 * ============================================================ */
.nearby-trains-pane {
    position: absolute;
    z-index: 2000;
    width: 320px;
    max-width: 90vw;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nearby-header {
    background: rgba(var(--brand-main-rgb), 0.1);
    padding: 10px 15px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.nearby-minimize-btn {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.nearby-minimize-btn:hover {
    opacity: 1;
}

.nearby-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nearby-item {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
body.dark-mode .nearby-item {
    background: rgba(0, 0, 0, 0.3);
}

.nearby-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nearby-item-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-main);
}
.nearby-item-status {
    font-size: 11px;
    color: var(--text-sub);
}
.nearby-item-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.nearby-item-eta {
    font-weight: 700;
    font-size: 14px;
    color: var(--brand-main);
}
.nearby-item-dist {
    font-size: 10px;
    color: var(--text-sub);
}

.nearby-trains-min {
    position: absolute;
    z-index: 2000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: all 0.2s;
    font-size: 16px;
    color: var(--text-main);
}
.nearby-trains-min:hover {
    transform: scale(1.05);
}
.nearby-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 800;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Positioning based on screen size */
@media (min-width: 769px) {
    .nearby-trains-pane {
        bottom: 80px;
        right: 20px;
        left: auto;
        transform: none;
        width: 320px;
    }
    .nearby-trains-min {
        bottom: 20px;
        right: 20px;
        left: auto;
        transform: none;
        width: 140px;
        height: 48px;
        border-radius: 12px;
        justify-content: flex-start;
        padding-left: 15px;
    }
    .nearby-trains-min:hover {
        transform: scale(1.02);
    }
    .nearby-trains-min i {
        margin-right: 8px;
    }
    .nearby-trains-min::after {
        content: 'Kereta Mendekat';
        font-size: 13px;
        font-weight: 700;
    }
}

@media (max-width: 768px) {
    .nearby-trains-pane {
        bottom: 100px; /* Above the open pane floating button */
        left: 80px; /* To right of left controls */
        right: 70px; /* To left of right controls */
        width: auto;
        max-width: none;
        transform: none;
    }
    .nearby-trains-min {
        bottom: 145px; /* Above search visually, or positioned with other left buttons */
        left: 16px;
        transform: none;
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }
    .nearby-trains-min:hover {
        transform: scale(1.05);
    }
}

/* Fix minimizing animation scaling */
.nearby-trains-min {
    transform-origin: center;
    animation: shrinkIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes shrinkIn {
    from { transform: scale(1.2); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
