:root {
    /* Brand Colors */
    --brand-primary: #EC1628;
    --brand-secondary: #064789;
    /* Apple Light Mode Semantics */
    --sys-bg: #F2F2F7;
    --sys-surface: #FFFFFF;
    --sys-surface-hover: #E5E5EA;
    --sys-separator: #C6C6C8;
    --sys-text-primary: #000000;
    --sys-text-secondary: rgba(60, 60, 67, 0.6);
    --sys-text-tertiary: rgba(60, 60, 67, 0.3);
    --radius-sheet: 24px;
    --radius-card: 16px;
    --radius-btn: 12px;
    --shadow-float: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-sheet: 0 -4px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    /* Apple Dark Mode Semantics */
    --sys-bg: #000000;
    --sys-surface: #1C1C1E;
    --sys-surface-hover: #2C2C2E;
    --sys-separator: #38383A;
    --sys-text-primary: #FFFFFF;
    --sys-text-secondary: rgba(235, 235, 245, 0.6);
    --sys-text-tertiary: rgba(235, 235, 245, 0.3);
    --shadow-float: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-sheet: 0 -4px 24px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    background: var(--sys-bg);
    color: var(--sys-text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
    transition: background 0.3s ease, color 0.3s ease;
}

button,
a,
input {
    font-family: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

.mono {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Map Container */
#mapContainer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

[data-theme="dark"] .leaflet-layer,
[data-theme="dark"] .leaflet-control-zoom-in,
[data-theme="dark"] .leaflet-control-zoom-out,
[data-theme="dark"] .leaflet-control-attribution {
    filter: invert(100%) hue-rotate(180deg) brightness(90%) contrast(90%);
}

/* Floating Top Controls (Branding + Actions) */
.top-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 12px;
}

.floating-pill {
    background: var(--sys-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--sys-separator);
    border-radius: 999px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-float);
    min-height: 48px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    background-color: var(--brand-primary);
    -webkit-mask: url('../images/iett_logo.svg') no-repeat center / contain;
    mask: url('../images/iett_logo.svg') no-repeat center / contain;
    transition: background-color 0.3s ease;
}

[data-theme="dark"] .brand-logo-img {
    background-color: #FFFFFF;
}

.brand-divider {
    width: 1px;
    height: 24px;
    background: var(--sys-separator);
}

.lang-btn {
    font-weight: 700;
    font-size: 15px;
}

.brand-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    display: none;
}

@media(min-width: 768px) {
    .brand-text {
        display: block;
    }
}

.action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sys-text-primary);
    background: var(--sys-surface-hover);
    transition: all 0.2s ease;
}

    .action-btn:hover {
        filter: brightness(0.9);
    }

    .action-btn svg {
        width: 20px;
        height: 20px;
    }

/* App Panel (Sidebar on Desktop, Bottom Sheet on Mobile) */
.app-panel {
    position: absolute;
    z-index: 100;
    background: var(--sys-surface);
    box-shadow: var(--shadow-sheet);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Desktop Panel */
@media(min-width: 768px) {
    .app-panel {
        top: 20px;
        left: 20px;
        bottom: 20px;
        width: 420px;
        border-radius: var(--radius-sheet);
        border: 1px solid var(--sys-separator);
    }
}

/* Mobile Bottom Sheet */
@media(max-width: 767px) {
    .app-panel {
        bottom: 0;
        left: 0;
        right: 0;
        height: 80dvh;
        max-height: 85dvh;
        transform: translateY(calc(85dvh - 45vh));
        border-top-left-radius: var(--radius-sheet);
        border-top-right-radius: var(--radius-sheet);
        border-top: 1px solid var(--sys-separator);
        will-change: transform;
    }

        .app-panel.expanded {
            transform: translateY(0);
            height: 92dvh;
            max-height: 92dvh;
        }

        .app-panel.collapsed {
            transform: translateY(calc(85dvh - 75px));
        }

        .app-panel.animating {
            transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), height 0.3s cubic-bezier(0.32, 0.72, 0, 1);
        }

    .sheet-handle {
        width: 40px;
        height: 5px;
        background: var(--sys-separator);
        border-radius: 10px;
    }

    .drag-zone {
        touch-action: none;
        cursor: grab;
        display: flex;
        justify-content: center;
        width: 100%;
        padding: 12px 0 8px;
        flex-shrink: 0;
        background: var(--sys-surface);
    }

        .drag-zone:active {
            cursor: grabbing;
        }
}

/* Search Area inside Panel */
.search-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--sys-separator);
    position: relative;
    flex-shrink: 0;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--sys-bg);
    border-radius: var(--radius-btn);
    padding: 0 16px;
    min-height: 52px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

    .search-box:focus-within {
        border-color: var(--brand-secondary);
        background: var(--sys-surface);
    }

    .search-box svg {
        width: 22px;
        height: 22px;
        color: var(--sys-text-secondary);
        flex-shrink: 0;
    }

    .search-box input {
        flex: 1;
        background: none;
        border: none;
        outline: none;
        color: var(--sys-text-primary);
        font-size: 17px;
        font-weight: 500;
        height: 100%;
    }

        .search-box input::placeholder {
            color: var(--sys-text-secondary);
        }

.search-clear {
    color: var(--sys-text-secondary);
    display: none;
    padding: 10px;
    margin-right: -8px;
}

    .search-clear.show {
        display: flex;
    }

/* Content Area - Düzeltilmiş Yapı */
.panel-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
    position: relative;
}

.search-results {
    flex: 1;
    background: var(--sys-surface);
    z-index: 50;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: none;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

    .search-results.open {
        display: flex;
        flex-direction: column;
    }

    .search-results::-webkit-scrollbar,
    .content-scroll::-webkit-scrollbar {
        width: 6px;
        display: block !important;
    }

    .search-results::-webkit-scrollbar-track,
    .content-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .search-results::-webkit-scrollbar-thumb,
    .content-scroll::-webkit-scrollbar-thumb {
        background: rgba(120, 120, 128, 0.3);
        border-radius: 4px;
    }

        .search-results::-webkit-scrollbar-thumb:hover,
        .content-scroll::-webkit-scrollbar-thumb:hover {
            background: rgba(120, 120, 128, 0.7);
        }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 10px;
    color: var(--sys-text-secondary);
}

    .empty-state svg {
        width: 48px;
        height: 48px;
        color: var(--brand-secondary);
        margin-bottom: 20px;
        opacity: 0.8;
    }

    .empty-state h2 {
        font-size: 22px;
        color: var(--sys-text-primary);
        font-weight: 700;
        margin-bottom: 12px;
        letter-spacing: -0.02em;
    }

    .empty-state p {
        font-size: 16px;
        line-height: 1.5;
        margin-bottom: 30px;
    }

.suggestion-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.suggestion-chip {
    padding: 12px 20px;
    background: var(--sys-bg);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    color: var(--sys-text-primary);
    border: 1px solid var(--sys-separator);
    transition: all 0.2s ease;
}

    .suggestion-chip:active {
        transform: scale(0.96);
        background: var(--sys-surface-hover);
    }

.footer-credit {
    text-align: center;
    padding: 40px 20px 20px;
    color: var(--sys-text-secondary);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-logo {
    height: 36px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.heart-icon {
    display: inline-block;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

    .heart-icon:hover {
        transform: scale(1.35);
    }

[data-theme="dark"] .footer-logo {
    filter: grayscale(100%) invert(1);
    opacity: 0.8;
}

.result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--sys-separator);
    width: 100%;
    text-align: left;
    min-height: 72px;
}

    .result-row:active {
        background: var(--sys-surface-hover);
    }

.result-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .result-main b {
        font-size: 17px;
        font-weight: 600;
        color: var(--sys-text-primary);
    }

    .result-main span {
        font-size: 14px;
        color: var(--sys-text-secondary);
    }

.result-code {
    font-size: 14px;
    color: #fff;
    background: var(--brand-secondary);
    padding: 6px 10px;
    border-radius: 8px;
    font-weight: 700;
}


.stop-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.stop-title {
    flex: 1;
}

.stop-eyebrow {
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    display: block;
}

.stop-title h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stop-title .sub {
    font-size: 16px;
    color: var(--sys-text-secondary);
    font-weight: 500;
}

.stop-code-badge {
    text-align: right;
}

    .stop-code-badge .code {
        font-size: 20px;
        font-weight: 700;
        color: var(--sys-text-primary);
        display: block;
    }

    .stop-code-badge .label {
        font-size: 12px;
        color: var(--sys-text-secondary);
        text-transform: uppercase;
    }

/* Big Action Button */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    background: var(--brand-secondary);
    color: #fff;
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 0px;
    transition: opacity 0.2s ease;
}

    .btn-primary:active {
        opacity: 0.8;
    }

    .btn-primary svg {
        width: 20px;
        height: 20px;
    }

/* Lines Grid */
.section-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding:5px;
}

    .section-title span {
        font-size: 15px;
        font-weight: 500;
        color: var(--sys-text-secondary);
    }

.lines-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.line-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--sys-bg);
    border-radius: var(--radius-card);
    border: 1px solid var(--sys-separator);
    text-align: left;
    min-height: 72px;
}

    .line-card:active {
        background: var(--sys-surface-hover);
    }

    .line-card.selected {
        border: 2px solid var(--brand-secondary);
        background: var(--sys-surface);
    }

.line-badge {
    min-width: 52px;
    height: 40px;
    border-radius: 10px;
    background: rgba(6, 71, 137, 0.1);
    color: var(--brand-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.line-card.selected .line-badge {
    background: var(--brand-secondary);
    color: #fff;
}

.line-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

    .line-meta span {
        font-size: 15px;
        font-weight: 600;
        color: var(--sys-text-primary);
    }

    .line-meta small {
        font-size: 13px;
        color: var(--sys-text-secondary);
        font-weight: 500;
    }

/* Vehicles Detail */
.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--sys-separator);
}

.back-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--sys-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-secondary);
}

    .back-btn:active {
        background: var(--sys-surface-hover);
    }

.detail-title {
    flex: 1;
    display: flex;
    flex-direction: column;
}

    .detail-title b {
        font-size: 18px;
        font-weight: 700;
        color: var(--sys-text-primary);
    }

    .detail-title span {
        font-size: 14px;
        color: var(--sys-text-secondary);
    }

.update-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34C759;
    margin-left: auto;
}

.vehicle-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--sys-bg);
    border-radius: var(--radius-card);
    margin-bottom: 12px;
    border: 1px solid var(--sys-separator);
}

.vehicle-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(6, 71, 137, 0.1);
    color: var(--brand-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .vehicle-icon svg {
        width: 24px;
        height: 24px;
    }

.vehicle-row.imminent .vehicle-icon {
    background: rgba(236, 22, 40, 0.1);
    color: var(--brand-primary);
}

.vehicle-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.vehicle-info-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .vehicle-info-top b {
        font-size: 16px;
        font-weight: 700;
        color: var(--sys-text-primary);
    }

.plate {
    font-size: 13px;
    color: var(--sys-text-secondary);
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--sys-separator);
    position: relative;
    overflow: hidden;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--brand-secondary);
    transition: width 1s ease;
}

.vehicle-row.imminent .progress-fill {
    background: var(--brand-primary);
}

.occ-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--sys-text-secondary);
    font-weight: 500;
}

.eta-block {
    text-align: right;
    flex-shrink: 0;
    min-width: 60px;
}

    .eta-block .num {
        font-size: 28px;
        font-weight: 800;
        color: var(--brand-secondary);
        line-height: 1;
    }

.vehicle-row.imminent .eta-block .num {
    color: var(--brand-primary);
}

.eta-block .unit {
    font-size: 13px;
    font-weight: 600;
    color: var(--sys-text-secondary);
}

/* Map Marker Customization */
.stop-marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-secondary);
    border: 4px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

.stop-marker-pulse {
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
    background: rgba(236, 22, 40, 0.3);
    animation: markerPulse 2s ease-out infinite;
    z-index: 1;
}

@keyframes markerPulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Captcha Modal */
.captcha-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

    .captcha-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

.captcha-box {
    background: var(--sys-surface);
    border: 1px solid var(--sys-separator);
    border-radius: var(--radius-card);
    padding: 24px;
    width: 320px;
    box-shadow: var(--shadow-float);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.captcha-overlay.show .captcha-box {
    transform: scale(1);
}

.captcha-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--sys-text-primary);
    margin-bottom: 8px;
}

.leaflet-top.leaflet-right {
    top: 80px;
}

@media(max-width: 767px) {
    .leaflet-top.leaflet-right {
        top: 80px;
        right: 0px;
    }
}

.directions-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--brand-secondary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

    .directions-btn:active {
        opacity: 0.8;
    }

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

    .modal-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }

    .modal-backdrop .modal-content {
        transform: scale(0.9) translateY(-20px);
        transition: transform 0.25s ease;
    }

    .modal-backdrop.show .modal-content {
        transform: scale(1) translateY(0);
    }

.line-filter-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.line-filter-container {
    display: flex;
    gap: 8px;
    padding: 4px 44px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
    scroll-behavior: smooth;
    cursor: grab;
}

    .line-filter-container:active {
        cursor: grabbing;
    }

    .line-filter-container::-webkit-scrollbar {
        display: none;
    }

.filter-chip {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--sys-bg);
    border: 1px solid var(--sys-separator);
    font-size: 14px;
    font-weight: 600;
    color: var(--sys-text-primary);
}

    .filter-chip.active {
        background: var(--brand-secondary);
        color: #fff;
        border-color: var(--brand-secondary);
    }

    .filter-chip:active {
        transform: scale(0.95);
    }

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: var(--sys-surface);
    border: 1px solid var(--sys-separator);
    color: var(--sys-text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s;
}

    .slider-arrow:hover {
        background: var(--brand-secondary);
        color: #fff;
        border-color: var(--brand-secondary);
    }

    .slider-arrow.left {
        left: 12px;
    }

    .slider-arrow.right {
        right: 12px;
    }
