/* ─── Expanded widget ─────────────────────────────────────────────────────── */

.gopak-widget {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1050;
    width: 380px;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    font-size: 0.875rem;
}

.gopak-widget--hidden {
    display: none;
}

/* ─── Completed band ──────────────────────────────────────────────────────── */

.gopak-widget__completed {
    background: #f3f4f5;
    padding: 0.75rem 1rem;
}

.gopak-widget__completed--empty {
    display: none;
}

.gopak-widget__completed-header {
    font-weight: 700;
    font-size: 0.8rem;
    color: #444;
    margin-bottom: 0.5rem;
}

/* ─── Active section ──────────────────────────────────────────────────────── */

.gopak-widget__active {
    padding: 1rem 1.25rem 1.25rem;
}

.gopak-widget__active-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.gopak-widget__active-name {
    font-weight: 700;
    font-size: 1rem;
    color: #222;
}

/* Groups the name and pct spans so the toggle button stays pushed right */
.gopak-widget__active-title {
    flex: 1;
    min-width: 0;
}

.gopak-widget__active-pct {
    font-weight: 700;
    font-size: 1rem;
}

.gopak-widget__active-pct--filling {
    color: #e8931a;
}

.gopak-widget__active-pct--ready {
    color: #6a8c3f;
}

.gopak-widget__toggle {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 3px 5px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    flex-shrink: 0;
}

.gopak-widget__toggle:hover {
    color: #444;
    border-color: #999;
}

/* ─── Bar & markers ───────────────────────────────────────────────────────── */

/* 22px margin = half the 44px marker width, keeps markers from clipping */
.gopak-widget__bar-wrap {
    position: relative;
    height: 52px;
    display: flex;
    align-items: center;
    margin: 40px 22px 0;
}

.gopak-widget__bar-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 10px;
    border-radius: 5px;
    background: #ddd;
}

.gopak-widget__bar-fill {
    height: 100%;
    border-radius: 5px;
    background: #e8931a;
    transition: width 0.5s ease, background 0.3s ease;
}

.gopak-widget__bar-fill--ready {
    background: #6a8c3f;
}

.gopak-widget__marker {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transform: translateX(-50%);
}

.gopak-widget__marker--active {
    background: #e8931a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    color: #fff;
    transition: left 0.5s ease;
    z-index: 3;
}

.gopak-widget__marker--active.gopak-widget__marker--ready {
    background: #6a8c3f;
}

.gopak-widget__marker--end {
    left: 100%;
    background: #fff;
    border: 2px solid #6a8c3f;
    color: #6a8c3f;
}

/* ─── Bar labels ──────────────────────────────────────────────────────────── */

.gopak-widget__bar-labels {
    position: relative;
    height: 20px;
    margin: 0.25rem 22px 0;
}

.gopak-widget__label--end {
    position: absolute;
    left: 100%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 0.78rem;
    color: #555;
    white-space: nowrap;
    top: 0;
}

/* ─── Threshold tick ──────────────────────────────────────────────────────── */

/* Zero-width anchor at 90% of the bar track */
.gopak-widget__tick {
    position: absolute;
    left: 90%;
    transform: translateX(-50%);
    top: 0;
    bottom: 0;
    width: 0;
    z-index: 3;
}

/* Full tick line: extends 8px above and below the 10px track */
.gopak-widget__tick-line {
    position: absolute;
    left: -1px;
    top: calc(50% - 13px);
    height: 26px;
    width: 2px;
    background: #6a8c3f;
    border-radius: 1px;
}

/* Short connector between label and tick line */
.gopak-widget__tick-stem {
    position: absolute;
    left: -1px;
    top: calc(50% - 25px);
    height: 12px;
    width: 2px;
    background: #6a8c3f;
    border-radius: 1px;
}

/* "Ready to ship" label above stem */
.gopak-widget__tick-label {
    position: absolute;
    left: 0;
    transform: translateX(-50%);
    top: calc(50% - 43px);
    font-size: 0.72rem;
    font-weight: 600;
    color: #6a8c3f;
    white-space: nowrap;
}

/* ─── Minimized pill ──────────────────────────────────────────────────────── */

.gopak-widget__pill {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1050;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: #6a8c3f;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
}

.gopak-widget__pill--hidden {
    display: none;
}

.gopak-widget__pill:hover {
    background: #5c7a35;
}

.gopak-widget__pill-label {
    /* inherits font-size/weight/color from .gopak-widget__pill */
}

/* ─── Pop-up stack ────────────────────────────────────────────────────────── */

.gopak-popups {
    position: fixed;
    /* 210px ≈ active-section height; increase if completed band frequently has many entries */
    bottom: calc(1.5rem + 210px);
    right: 1.5rem;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 200px;
    pointer-events: none;
}

.gopak-popup {
    padding: 0.625rem 0.75rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-left-width: 3px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: auto;
    animation: gopak-popup-in 0.2s ease forwards;
}

.gopak-popup--added   { border-left-color: #198754; }
.gopak-popup--removed { border-left-color: #ffc107; }
.gopak-popup--first   { border-left-color: #0d6efd; }

.gopak-popup__close {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 2px 4px;
    min-height: 24px;
    flex-shrink: 0;
    border-radius: 3px;
    margin-left: auto;
}

.gopak-popup__close:hover { color: #555; background: #f0f0f0; }
.gopak-popup__close:focus-visible { outline: 2px solid #0d6efd; outline-offset: 1px; }

@keyframes gopak-popup-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* ─── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 576px) {
    .gopak-widget,
    .gopak-widget__pill,
    .gopak-popups {
        bottom: 1rem;
        right: 1rem;
    }

    .gopak-widget {
        width: calc(100vw - 2rem);
    }
}
