:root {
    /* Color Palette - Dark Premium Theme */
    --bg-surface: rgba(18, 18, 20, 0.75);
    --bg-surface-hover: rgba(30, 30, 35, 0.85);
    --text-primary: #f8f9fc;
    --text-secondary: #a1a1aa;
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.4);
    --border-color: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --error: #ef4444;

    /* Variables */
    --panel-width: 380px;
    --radius-lg: 20px;
    --radius-md: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body,
html {
    height: 100%;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    background-color: #000;
    overflow: hidden;
}

#app {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
}

/* MAP CONTAINER */
.map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ======== 3D MARKER STYLES ======== */

/* Durak marker */
.stop-marker-3d {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.stop-marker-3d:hover {
    transform: scale(1.5);
    z-index: 10 !important;
}

.stop-dot {
    width: 14px;
    height: 14px;
    background: radial-gradient(circle, #ffffff 30%, var(--accent) 100%);
    border: 2px solid var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-glow), 0 0 20px rgba(6, 182, 212, 0.2);
}

/* Otobüs marker */
.bus-marker-3d {
    cursor: pointer;
}

.bus-arrow {
    background: linear-gradient(135deg, var(--accent) 0%, #0369a1 100%);
    padding: 6px;
    border-radius: 50%;
    box-shadow: 0 0 18px var(--accent-glow), 0 2px 8px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.bus-marker-3d:hover .bus-arrow {
    box-shadow: 0 0 30px var(--accent-glow), 0 0 60px rgba(6, 182, 212, 0.3);
    transform: scale(1.15);
}

/* Takip edilen (Kilitlenmiş) Otobüs Stili */
.tracked .bus-arrow {
    border-color: #10b981;
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.6), 0 0 20px rgba(16, 185, 129, 0.3) inset;
    transform: scale(1.2);
    animation: trackingPulse 2s infinite;
}

@keyframes trackingPulse {
    0% {
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.5), 0 0 0 0 rgba(16, 185, 129, 0.6);
    }

    70% {
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.5), 0 0 0 20px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.5), 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* User GPS Location Marker */
.user-location-marker {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dot {
    width: 16px;
    height: 16px;
    background-color: #3b82f6;
    /* Blue */
    border: 3px solid #ffffff;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
}

.user-radar {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    z-index: 1;
    animation: radarPulse 2s infinite;
}

@keyframes radarPulse {
    0% {
        transform: scale(0.1);
        opacity: 0.8;
    }

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

/* ======== MAPLIBRE POPUP DARK THEME ======== */
.dark-popup .maplibregl-popup-content {
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    padding: 14px;
    font-family: 'Inter', sans-serif;
}

.dark-popup .maplibregl-popup-tip {
    border-top-color: rgba(15, 15, 20, 0.95);
}

.dark-popup .maplibregl-popup-close-button {
    color: var(--text-secondary);
    font-size: 18px;
    padding: 4px 8px;
}

.dark-popup .maplibregl-popup-close-button:hover {
    color: var(--accent);
    background: none;
}

.custom-popup .title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--accent);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.custom-popup .detail {
    font-size: 0.85rem;
    margin: 4px 0;
    color: #cbd5e1;
    display: flex;
    justify-content: space-between;
}

.custom-popup .detail strong {
    color: var(--text-secondary);
}

/* ======== GLASSMORPHISM CONTROL PANEL ======== */
.control-panel {
    position: absolute;
    top: 24px;
    left: 24px;
    width: var(--panel-width);
    z-index: 1000;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 24px;
    transition: var(--transition);
}

.panel-header .logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.panel-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.panel-header h1 span {
    color: var(--accent);
}

.panel-header .subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pulse-dot {
    width: 12px;
    height: 12px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* INPUT CONTROLS */
.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.select-wrapper {
    position: relative;
}

select {
    width: 100%;
    appearance: none;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    padding: 14px 40px 14px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

select:hover,
select:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

select option {
    background-color: #1a1a1e;
    color: var(--text-primary);
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    pointer-events: none;
    color: var(--text-secondary);
    transition: var(--transition);
}

/* STATUS PANELS */
.status-panel {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 16px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-value {
    font-size: 1rem;
    font-weight: 600;
}

.status-value.highlight {
    color: var(--accent);
    font-size: 1.25rem;
}

/* BUTTONS */
.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent) 0%, #0369a1 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px var(--accent-glow);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.6);
}

.primary-btn:active {
    transform: translateY(0);
}

.refresh-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.5s ease;
}

.primary-btn.loading .refresh-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* SECONDARY BUTTON (Uydu toggle) */
.secondary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent);
}

/* TOAST NOTIFICATION */
.toast-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* MapLibre GL Navigation Controls - Dark Theme */
.maplibregl-ctrl-group {
    background: rgba(15, 15, 20, 0.85) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
}

.maplibregl-ctrl-group button {
    border-color: var(--border-color) !important;
}

.maplibregl-ctrl-group button+button {
    border-top: 1px solid var(--border-color) !important;
}

.maplibregl-ctrl button .maplibregl-ctrl-icon {
    filter: invert(1) brightness(0.8);
}

/* RESPONSIVE DESIGN (MOBİL UYUM) */
@media (max-width: 768px) {
    .control-panel {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 40vh;
        overflow-y: auto;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        padding: 12px 16px 20px;
        gap: 12px;
    }

    /* Panel üstüne çekme çubuğu */
    .control-panel::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
        margin: 0 auto 8px;
        flex-shrink: 0;
    }

    .panel-header h1 {
        font-size: 1.15rem;
    }

    .panel-header .subtitle {
        font-size: 0.75rem;
    }

    .controls {
        gap: 10px;
    }

    select {
        padding: 10px 36px 10px 12px;
        font-size: 0.9rem;
    }

    .status-panel {
        padding: 10px 12px;
    }

    .status-label {
        font-size: 0.65rem;
    }

    .status-value {
        font-size: 0.85rem;
    }

    .primary-btn,
    .secondary-btn {
        padding: 10px;
        font-size: 0.85rem;
    }

    /* Otobüs marker'ı mobilde biraz büyüt (kolay tıklama) */
    .bus-marker-3d .bus-arrow {
        padding: 8px;
    }

    .bus-marker-3d .bus-arrow svg {
        width: 32px;
        height: 32px;
    }

    /* MapLibre kontrolleri mobilde küçült */
    .maplibregl-ctrl-group {
        transform: scale(0.85);
        transform-origin: bottom right;
    }
}