:root {
    --topbar: 200px;
}

#panel {
    position: fixed;
    left: 20px;
    bottom: 20px;

    width: 400px;
    max-width: 92vw;

    display: none;
    flex-direction: column;

    border-radius: 40px;
    background: rgba(20, 20, 20, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08);

    color: white;
    z-index: 10;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

    overflow: auto;

    max-height: calc(100vh - var(--topbar) - 40px);

    transform-origin: bottom left;

    opacity: 0;
    transform: translateY(40px) scale(0.8);
    transition: 0.35s cubic-bezier(.2, .9, .2, 1);
}

#panel.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#panel_img {
    height: 180px;
    min-height: 180px;
    width: 100%;
    position: relative;
    background: #111;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    background-repeat: no-repeat;
}

#panel_img::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.85));
}

#panel_top_info {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 3;
    display: flex;
    gap: 8px;
}

#p_zadanie_badge,
#p_taborowy_badge,
#p_dolacz_badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 6px 14px;
    border-radius: 14px;

    font-size: 12px;
    font-weight: 800;

    line-height: 1;
}

#p_zadanie_badge {
    background: #ffd500;
    color: black;
}

#p_taborowy_badge {
    background: #baffba;
    color: black;
}

#p_dolacz_badge {
    background: #ffffff;
    color: black;
}

#panel_title {
    position: absolute;
    top: 135px;
    left: 20px;
    z-index: 3;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

#p_id {
    margin: 16px 20px 4px 20px;
    font-size: 15px;
    font-weight: 600;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

.status_bar {
    display: flex;
    justify-content: space-between;
    margin: 8px 20px 0 20px;
    padding: 12px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    font-weight: 600;
}

.section {
    margin: 12px 20px;
    opacity: 0;
}

.section_title {
    font-size: 11px;
    opacity: 0.5;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

#stops_container {
    cursor: pointer;
}

#stops_preview,
#full_stops_list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#full_stops_list {
    max-height: 240px;
    overflow-y: auto;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#full_stops_list_wrapper {
    display: none;
}

#panel.show-full-route #full_stops_list_wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.back-button {
    padding: 10px 16px;
    border-radius: 16px;
    background: rgba(79, 172, 254, 0.2);
    border: 1px solid rgba(79, 172, 254, 0.4);
    color: #4facfe;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-size: 13px;
}

.back-button:hover {
    background: rgba(79, 172, 254, 0.3);
    border-color: rgba(79, 172, 254, 0.6);
}

#full_stops_list::-webkit-scrollbar {
    width: 4px;
}

#full_stops_list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

#panel.show-full-route #stops_preview {
    display: none;
}

#panel.show-full-route #full_stops_list_wrapper {
    display: flex;
}

#panel.show-full-route #stats_section {
    display: none;
}

.stop_item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    opacity: 0.5;
    transition: 0.2s;
    padding: 4px 0;
}

.stop_item.active {
    opacity: 1;
    color: #4facfe;
    font-weight: 700;
}

.stop_dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
}

.stop_item.active .stop_dot {
    background: #4facfe;
    box-shadow: 0 0 12px #4facfe;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.box {
    padding: 16px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.box.full {
    grid-column: span 2;
}

.icon {
    font-size: 12px;
    opacity: 0.5;
    margin-bottom: 6px;
    font-weight: 600;
}

#close {
    position: absolute;
    top: 14px;
    right: 14px;
    cursor: pointer;
    font-size: 22px;
    opacity: 0.6;
    z-index: 10;
    transition: 0.2s;
}

#close:hover {
    opacity: 1;
    transform: scale(1.1);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#panel.show .section {
    animation: fadeUp 0.5s cubic-bezier(.2, .9, .2, 1) forwards;
    animation-delay: var(--d);
}

@media (max-width: 700px) {
    #panel {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 50vh;
        max-height: 50vh;
        border-radius: 28px 28px 0 0;
        box-shadow: 0 -20px 80px rgba(0, 0, 0, 0.6);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #panel_img {
        display: block; 
        height: 150px;
        min-height: 150px;
        border-radius: 28px 28px 0 0; 
    }

    #panel_top_info {
        position: absolute;
        top: 16px;
        left: 16px;
        margin: 0;
        z-index: 3;
    }

    #panel_title {
        position: absolute;
        top: 105px; 
        left: 16px;
        margin: 0;
        font-size: 20px;
        z-index: 3;
    }

    #p_id {
        font-size: 16px; 
        margin: 16px 16px 4px 16px;
        padding-bottom: 8px;
    }

    .section {
        margin: 12px 16px;
    }

    .status_bar {
        margin: 8px 16px 0 16px;
    }

    .box {
        padding: 14px;
        border-radius: 20px;
    }

    .stop_item {
        font-size: 14px;
    }
}

.stop_name {
    flex: 1;
}

.stop_meta {
    font-size: 12px;
    opacity: .75;
    white-space: nowrap;
}
