/* ═══════════════════════════════════════════════════════════
   LAYOUT PICKER — SINGLE SOURCE OF TRUTH
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   LAYOUT PICKER BUTTON
   ═══════════════════════════════════════════════════════════ */
#layoutPickerBtn { margin-right: 2px; }
.layout-picker-btn { border-radius: 10px; }
.layout-picker-btn:hover { background: var(--ui-button-hover); color: var(--ui-fg); }

/* ═══════════════════════════════════════════════════════════
   LAYOUT PICKER WRAPPER
   ═══════════════════════════════════════════════════════════ */
.layout-picker-wrap {
    position: relative;
    display: inline-flex !important;
    align-items: center;
    flex: 0 0 auto;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 20;
}
.layout-picker-wrap > #layoutPickerBtn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ═══════════════════════════════════════════════════════════
   POPUP CONTAINER
   ═══════════════════════════════════════════════════════════ */
.layout-picker-dropdown {
    position: fixed;
    background: var(--ui-panel);
    border: 1px solid var(--ui-panel-border, rgba(128,128,128,.2));
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
    z-index: 10050;
    width: 196px;
    overflow: hidden;
    user-select: none;
}
.layout-picker-dropdown.hidden { display: none; }

/* ═══════════════════════════════════════════════════════════
   GRID SELECTOR
   ═══════════════════════════════════════════════════════════ */
.lp-hover-grid {
    padding: 8px 8px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}
.lp-hover-row {
    display: flex;
    gap: 2px;
    justify-content: center;
}
.lp-hover-cell {
    width: 30px;
    height: 24px;
    border: 1.5px solid rgba(128,128,128,.22);
    border-radius: 5px;
    background: transparent;
    flex-shrink: 0;
    transition: background 0.08s, border-color 0.08s;
}
.lp-hover-cell-on {
    background: rgba(56, 189, 177, 0.20);
    border-color: rgba(56, 189, 177, 0.70);
}
.lp-hover-cell:hover {
    border-color: rgba(56, 189, 177, 0.90);
}

/* ═══════════════════════════════════════════════════════════
   DIMENSION LABEL
   ═══════════════════════════════════════════════════════════ */
.lp-dim-label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--ui-fg);
    padding: 5px 0 4px;
    min-height: 20px;
    letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════════════════════ */
.lp-divider {
    height: 1px;
    background: var(--ui-panel-border, rgba(128,128,128,.2));
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   SYNC IN LAYOUT SECTION
   ═══════════════════════════════════════════════════════════ */
.lp-sync {
    padding: 8px 12px 10px;
}
.lp-sync-hdr {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .7px;
    color: var(--ui-muted, #888);
    text-transform: uppercase;
    margin-bottom: 5px;
}
.lp-sync-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 12px;
    color: var(--ui-fg);
}
.lp-sync-lbl {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}
.lp-sync-info {
    display: inline-flex;
    align-items: center;
    color: var(--ui-muted, #8a8a8a);
    cursor: default;
}
.lp-sync-info svg { display: block; }

/* ═══════════════════════════════════════════════════════════
   TOGGLE SWITCHES
   ═══════════════════════════════════════════════════════════ */
.lp-tog {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}
.lp-tog input { opacity: 0; width: 0; height: 0; position: absolute; }
.lp-tog-rail {
    position: absolute;
    inset: 0;
    background: rgba(128,128,128,.3);
    border-radius: 9px;
    transition: background 0.2s;
    cursor: pointer;
}
.lp-tog-rail::before {
    content: '';
    position: absolute;
    width: 12px; height: 12px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.lp-tog input:checked + .lp-tog-rail { background: var(--accent, #2962ff); }
.lp-tog input:checked + .lp-tog-rail::before { transform: translateX(12px); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE OVERRIDES
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .topbar-group-primary {
        overflow: visible !important;
    }
}

/* Tablet: smaller button */
@media (max-width: 991px) {
    #layoutPickerBtn {
        width: 26px;
        height: 26px;
        padding: 0 3px;
    }
}

/* Small tablet: wrapper sizing */
@media (min-width: 480px) and (max-width: 767px) {
    .topbar-group-primary #layout-picker-wrap {
        flex-shrink: 0;
        height: 36px;
        display: flex;
        align-items: center;
    }
}
