/* ==========================================================
   UTP Control Panel
   Foundation floating control surface
   ========================================================== */


/* ----------------------------------------------------------
   Trigger wrapper
   ---------------------------------------------------------- */

.utp-results-module-wrapper {
    position: relative;

    width: 100%;
    height: 100%;

    min-width: 0;
}

.utp-results-module-wrapper > .utp-results-module {
    width: 100%;
    height: 100%;
}


/* ----------------------------------------------------------
   Panel
   ---------------------------------------------------------- */

.utp-control-panel {
    position: absolute;

    top: calc(100% + 14px);
    right: 0;
    left: auto;

    width: 340px;
    max-width: calc(100vw - 32px);

    background:
        linear-gradient(
            145deg,
            rgba(34, 40, 52, 0.99),
            rgba(26, 31, 41, 0.99)
        );

    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 18px;

    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.34),
        0 8px 20px rgba(0, 0, 0, 0.18);

    overflow: visible;

    z-index: 5000;

    transform-origin: top right;

    animation:
        utp-control-panel-enter
        160ms
        ease-out;
}

.utp-control-panel[hidden] {
    display: none;
}


/* Small visual connection to the trigger card */

.utp-control-panel::before {
    content: "";

    position: absolute;

    top: -7px;
    right: 28px;

    width: 14px;
    height: 14px;

    background: #222834;

    border-top: 1px solid rgba(255, 255, 255, 0.10);
    border-left: 1px solid rgba(255, 255, 255, 0.10);

    transform: rotate(45deg);

    z-index: 1;
}


/* ----------------------------------------------------------
   Header
   ---------------------------------------------------------- */

.utp-control-panel__header {
    position: relative;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 64px;

    padding: 16px 18px 16px 20px;

    background: rgba(255, 255, 255, 0.015);

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px 18px 0 0;
}

.utp-control-panel__title {
    margin: 0;

    color: #ffffff;

    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.utp-control-panel__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    padding: 0;

    cursor: pointer;

    color: #98a2b3;
    background: transparent;

    border: 0;
    border-radius: 10px;

    font-family: inherit;
    font-size: 21px;
    line-height: 1;

    transition:
        color 140ms ease,
        background-color 140ms ease,
        transform 140ms ease;
}

.utp-control-panel__close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.utp-control-panel__close:active {
    transform: scale(0.94);
}

.utp-control-panel__close:focus-visible {
    outline: 2px solid #ff8a3d;
    outline-offset: 2px;
}


/* ----------------------------------------------------------
   Body
   ---------------------------------------------------------- */

.utp-control-panel__body {
    position: relative;
    z-index: 2;

    display: grid;
    gap: 8px;

    padding: 14px;
}


/* ----------------------------------------------------------
   Control options
   Generic styling for buttons inside the panel
   ---------------------------------------------------------- */

.utp-control-panel__body > button {
    position: relative;

    display: flex;
    align-items: center;

    width: 100%;
    min-height: 52px;

    padding: 13px 44px 13px 46px;

    cursor: pointer;
    text-align: left;

    color: #d8dee9;
    background: rgba(255, 255, 255, 0.025);

    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 13px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.3;

    transition:
        color 150ms ease,
        background-color 150ms ease,
        border-color 150ms ease,
        transform 150ms ease;
}


/* Radio-style indicator */

.utp-control-panel__body > button::before {
    content: "";

    position: absolute;

    left: 17px;
    top: 50%;

    width: 16px;
    height: 16px;

    border: 2px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;

    transform: translateY(-50%);

    transition:
        border-color 150ms ease,
        background-color 150ms ease,
        box-shadow 150ms ease;
}


/* Arrow on the right */

.utp-control-panel__body > button::after {
    content: "→";

    position: absolute;

    right: 17px;
    top: 50%;

    color: rgba(255, 255, 255, 0.34);

    font-size: 15px;

    transform: translateY(-50%);

    transition:
        color 150ms ease,
        transform 150ms ease;
}

.utp-control-panel__body > button:hover {
    color: #ffffff;

    background: rgba(255, 255, 255, 0.065);

    border-color: rgba(255, 255, 255, 0.13);

    transform: translateY(-1px);
}

.utp-control-panel__body > button:hover::before {
    border-color: rgba(255, 138, 61, 0.72);
}

.utp-control-panel__body > button:hover::after {
    color: #ff8a3d;

    transform:
        translateY(-50%)
        translateX(2px);
}

.utp-control-panel__body > button:active {
    transform: translateY(0);
}

.utp-control-panel__body > button:focus-visible {
    outline: 2px solid #ff8a3d;
    outline-offset: 2px;
}


/* ----------------------------------------------------------
   Active option
   results-controls.js already adds .is-active
   ---------------------------------------------------------- */

.utp-control-panel__body > button.is-active {
    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            rgba(255, 138, 61, 0.17),
            rgba(255, 138, 61, 0.07)
        );

    border-color: rgba(255, 138, 61, 0.42);
}

.utp-control-panel__body > button.is-active::before {
    background: #ff8a3d;

    border-color: #ff8a3d;

    box-shadow:
        inset 0 0 0 4px #222834,
        0 0 0 3px rgba(255, 138, 61, 0.12);
}

.utp-control-panel__body > button.is-active::after {
    color: #ff8a3d;
}


/* ----------------------------------------------------------
   Motion
   ---------------------------------------------------------- */

@keyframes utp-control-panel-enter {
    from {
        opacity: 0;

        transform:
            translateY(-6px)
            scale(0.985);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* ----------------------------------------------------------
   Responsive
   ---------------------------------------------------------- */

@media (max-width: 720px) {

    .utp-control-panel {
        position: fixed;

        top: auto;
        right: 16px;
        bottom: 16px;
        left: 16px;

        width: auto;
        max-width: none;

        transform-origin: bottom center;
    }

    .utp-control-panel::before {
        display: none;
    }

}