/* ============================================================
   Suggestion Box panel (respondtoscott 2026-11-19; js/app/shared/suggestionPanel.js).
   A NON-modal panel: no backdrop, the page underneath stays usable. It sits over the page (z 1180), under the
   assistant drawer (1200) and its round button (1190), and under the app's full-screen popups (100000 and up).
   Colours from theme tokens only; text sizes from the app's tokens and t- classes.
   At 600px or less it is a bottom sheet, never taller than 75% of the window, so the popup guard
   (js/framework/popupDismissGuard.js, which watches layers covering 90% of the window) never takes it for a popup.
   ============================================================ */

.sgp {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1180;
    /* Twice the first width (Steve 2026-11-19): room to write. A member's own size is set inline
       (suggestionPanel.js applySize); room is kept for the left menu and the assistant's round button. */
    width: 720px;
    max-width: calc(100vw - 102px);
    max-height: calc(100vh - 44px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background: var(--ui-backgrounds-panelBg);
    color: var(--ui-text-primaryText);
    border: 1px solid var(--ui-borders-borderDefault);
    border-radius: 14px;
    box-shadow:
        0 16px 40px rgba(var(--color-ui-shadow-rgb), 0.24),
        0 2px 8px rgba(var(--color-ui-shadow-rgb), 0.12);
}
.sgp[hidden],
.sgp-tab[hidden] { display: none; }

/* Beside the assistant's round button (bottom right, 52px), never over it. */
body:has(.assistant-launch-btn:not(.assistant-hidden)) .sgp.sgp--right,
body:has(.assistant-launch-btn:not(.assistant-hidden)) .sgp-tab.sgp--right { right: 86px; }
/* Left side: clear of the left menu (50px). */
.sgp.sgp--left { right: auto; left: 66px; }
/* Dragged: left / top are set on the element. */
.sgp.sgp--free { right: auto; bottom: auto; }
.sgp.is-dragging { opacity: 0.94; }

/* ---- Header: the drag handle ---- */
.sgp-head {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 8px 8px 16px;
    border-bottom: 1px solid var(--ui-borders-borderLight);
    cursor: grab;
    user-select: none;
    touch-action: none;
}
.sgp.is-dragging .sgp-head { cursor: grabbing; }
.sgp-title {
    flex: 1 1 auto;
    margin: 0;
    color: var(--ui-text-primaryText);
}
.sgp-icon-btn {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ui-text-secondaryText);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.sgp-icon-btn:hover {
    background: var(--ui-backgrounds-hoverBg);
    color: var(--ui-text-primaryText);
}
.sgp-icon-btn:focus-visible,
.sgp-shot-add:focus-visible,
.sgp-shot-remove:focus-visible,
.sgp-all:focus-visible,
.sgp-tab:focus-visible {
    outline: 2px solid var(--ui-borders-borderFocus);
    outline-offset: 2px;
}

/* ---- Body ---- */
.sgp-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 16px 14px;
    overflow-y: auto;
    min-height: 0;
}
.sgp-intro {
    margin: 0 0 4px;
    color: var(--ui-text-secondaryText);
}
.sgp-label {
    margin-top: 6px;
    font-weight: 600;
    color: var(--ui-text-primaryText);
}
.sgp-field {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border: 1px solid var(--ui-main-inputBorder);
    border-radius: 8px;
    background: var(--ui-backgrounds-cardBg);
    color: var(--ui-text-primaryText);
    font: inherit;
    font-size: var(--text-small, 14px);
}
.sgp-field:focus {
    outline: none;
    border-color: var(--ui-borders-borderFocus);
    box-shadow: 0 0 0 3px rgba(var(--color-blue-6-rgb), 0.18);
}
.sgp-field::placeholder { color: var(--ui-text-mutedText); }
/* Details is the main box: it takes whatever height the panel is given (the panel's edges resize, not the box). */
.sgp-text {
    flex: 1 1 auto;
    min-height: 96px;
    resize: none;
    line-height: 1.45;
}
.sgp-count {
    text-align: right;
    color: var(--ui-text-mutedText);
}
.sgp-count.is-near {
    color: var(--ui-text-primaryText);
    font-weight: 600;
}
/* ---- Screenshots (2026-11-19): private, our team only. Small previews with a remove button; the whole panel takes a
   dropped picture (dashed outline while one is over it). ---- */
.sgp-shots {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}
.sgp-shots-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.sgp-shots-head .sgp-label { margin-top: 0; }
.sgp-shot-add {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ui-text-linkText);
    font-weight: 600;
    cursor: pointer;
}
.sgp-shot-add:hover { text-decoration: underline; }
.sgp-shot-add[hidden],
.sgp-shot-list[hidden],
.sgp-shot-privacy[hidden] { display: none; }
.sgp-shot-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 6px;
}
.sgp-shot { position: relative; }
.sgp-shot img {
    display: block;
    height: 72px;
    width: auto;
    max-width: 160px;
    object-fit: cover;
    border: 1px solid var(--ui-borders-borderDefault);
    border-radius: 6px;
    background: var(--ui-backgrounds-cardBg);
}
.sgp-shot-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--ui-borders-borderDefault);
    border-radius: 50%;
    background: var(--ui-backgrounds-panelBg);
    color: var(--ui-text-secondaryText);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.sgp-shot-remove svg { width: 12px; height: 12px; }
.sgp-shot-remove:hover {
    background: var(--ui-backgrounds-hoverBg);
    color: var(--ui-text-primaryText);
}
.sgp-shot-note {
    margin: 0;
    color: var(--ui-text-secondaryText);
}
.sgp.is-dropping {
    outline: 2px dashed var(--ui-text-linkText);
    outline-offset: -6px;
}

/* Category and Sign with, side by side under Details (stacked when narrow). */
.sgp-options {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 24px;
}
.sgp-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 220px;
    min-width: 0;
}
.sgp-sign { flex: 0 1 auto; }
.sgp-sign-radios { display: flex; gap: 14px; }
.sgp-public {
    margin: 6px 0 0;
    color: var(--ui-text-secondaryText);
}
.sgp-status:empty { display: none; }
.sgp-status {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--ui-backgrounds-hoverBg);
    color: var(--ui-text-primaryText);
}
.sgp-status.is-success { border-left: 3px solid var(--color-semantic-success); }
.sgp-status.is-error { border-left: 3px solid var(--color-semantic-danger); }
.sgp-actions,
.sgp-confirm {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.sgp-actions [hidden],
.sgp-confirm[hidden] { display: none; }
.sgp-all {
    margin-left: auto;
    color: var(--ui-text-linkText);
    font-weight: 600;
    text-decoration: none;
}
.sgp-all:hover { text-decoration: underline; }

/* ---- Resize edges (Steve 2026-11-19): the side away from the pin sets the width, the top (bottom once dragged) the
   height; a small bar shows on hover and focus, as on the assistant drawer's edge. Inside the panel's padding. ---- */
.sgp-edge {
    position: absolute;
    z-index: 2;
    touch-action: none;
}
.sgp-edge::after {
    content: '';
    position: absolute;
    border-radius: 2px;
    background: transparent;
    transition: background 0.15s ease;
}
.sgp:hover .sgp-edge::after { background: var(--ui-borders-borderDefault); }
.sgp-edge:hover::after,
.sgp-edge:focus-visible::after,
body.sgp-resizing-x .sgp-edge-x::after,
body.sgp-resizing-y .sgp-edge-y::after { background: var(--ui-text-linkText); }
.sgp-edge:focus { outline: none; }
.sgp-edge-x { top: 14px; bottom: 14px; width: 10px; cursor: ew-resize; }
.sgp-edge-x::after { top: 50%; left: 3px; width: 4px; height: 44px; margin-top: -22px; }
.sgp.sgp--right .sgp-edge-x { left: 0; }
.sgp.sgp--left .sgp-edge-x,
.sgp.sgp--free .sgp-edge-x { right: 0; }
.sgp-edge-y { left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.sgp-edge-y::after { left: 50%; top: 2px; width: 44px; height: 4px; margin-left: -22px; }
.sgp.sgp--right .sgp-edge-y,
.sgp.sgp--left .sgp-edge-y { top: 0; }
.sgp.sgp--free .sgp-edge-y { bottom: 0; }
body.sgp-resizing { user-select: none; }
body.sgp-resizing-x { cursor: ew-resize; }
body.sgp-resizing-y { cursor: ns-resize; }
@media (pointer: coarse) {
    .sgp-edge-x { width: 14px; }
    .sgp-edge-y { height: 12px; }
}

/* ---- Minimized: a small tab at the edge ---- */
.sgp-tab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1180;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--ui-borders-borderDefault);
    border-radius: 999px;
    background: var(--ui-backgrounds-panelBg);
    color: var(--ui-text-primaryText);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(var(--color-ui-shadow-rgb), 0.22);
}
.sgp-tab.sgp--left { right: auto; left: 66px; }
.sgp-tab i { color: var(--ui-text-linkText); }
.sgp-tab:hover { background: var(--ui-backgrounds-hoverBg); }

/* ---- Phone width: a bottom sheet; the tab bottom left (the assistant's button is bottom right) ---- */
@media (max-width: 600px) {
    .sgp,
    .sgp.sgp--left,
    .sgp.sgp--right,
    .sgp.sgp--free {
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: auto !important;
        height: auto !important;
        max-width: none;
        max-height: 75vh;
        border-bottom: 0;
        border-radius: 14px 14px 0 0;
    }
    .sgp-head { cursor: default; }
    .sgp-move,
    .sgp-edge { display: none; }
    .sgp-tab,
    .sgp-tab.sgp--left,
    .sgp-tab.sgp--right {
        left: 12px !important;
        right: auto !important;
        bottom: 12px;
    }
}
