/* ── Compass Widget ──────────────────────────────────────────────────────── */

#compass-widget {
    position: absolute;
    top: 280px;        /* ranking widget height (~60px) + 50px gap — adjust to match */
    left: 17px;
    z-index: 2;
    font-family: Poppins, sans-serif;
    font-size: 12px;
}

#compass-toggle-btn:hover {
    cursor: pointer;
}

#compass-toggle-btn {
    background: white;
    color: black;
    font-family: Poppins, sans-serif;
    font-size: 9px;
    font-weight: 500;
    padding: 8px 12px;
    border: none;
    border-radius: 18px;
    cursor: default;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

#compass-arrow {
    font-size: 10px;
    color: black;
    transition: transform 0.3s ease;
    display: inline-block;
}

#compass-widget:hover #compass-arrow {
    transform: rotate(180deg);
}

/* Panel — slides down from under the button */
#compass-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 360px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.13);
    box-sizing: border-box;
    overflow: hidden;

    /* Ease transition via max-height + opacity */
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.35s ease, opacity 0.3s ease;
}

#compass-panel.compass-panel--open {
    max-height: 620px;
    opacity: 1;
    pointer-events: auto;
}

#compass-panel-inner {
    padding: 10px 12px 10px;
}

/* Axis selects */
#compass-axis-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.cw-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cw-label {
    font-size: 9px;
    font-weight: 600;
    color: black;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cw-select {
    font-family: Poppins;
    font-size: 9px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f0f0f0;
    color: black;
    outline: none;
    cursor: pointer;
}

.cw-select:focus {
    border-color: black;
}

/* Pills */
#cw-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 24px;
    margin-bottom: 6px;
    align-items: center;
}

.cw-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid;
}

.cw-pill-x {
    cursor: pointer;
    opacity: 0.6;
    font-size: 13px;
    line-height: 1;
}

.cw-pill-x:hover {
    opacity: 1;
}

/* Add row */
#cw-add-row {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}

#cw-country-select {
    flex: 1;
}

#cw-add-btn {
    font-family: Poppins;
    font-size: 9px;
    font-weight: 500;
    padding: 4px 10px;
    background: #f0f0f0;
    color: black;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.3s ease, color 0.3s ease;
}

#cw-add-btn:hover {
    background: black;
    color: white;
}

/* Chart */
#compass-chart-wrap {
    position: relative;
    width: 100%;
    height: 240px;
    margin-top: 8px;
}

#compass-canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Legend */
#compass-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 8px;
}

.compass-legend-description{
    margin-bottom: 0px;
    font-size: 10px !important;
    color: black;
    font-weight: 500;
}

.cw-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: black;
}

.cw-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cw-legend-ws {
    color: black;
    font-size: 10px;
}

@media (max-width: 731px) {
    #compass-widget {
        display: none !important;
    }
}