/*
 * windows.css
 *
 * Global WinBox overrides that apply to every virtual window.
 * Per-window styles are injected by each window module via injectStyles().
 */

.wb-body {
    background: #000;
    overflow: hidden;
}

/* Hide maximize, fullscreen, minimize, and close controls — windows are managed via settings */
.wb-max  { display: none; }
.wb-full { display: none; }
.wb-min  { display: none; }
.wb-close { display: none; }

/* -------------------------------------------------------------------------
 * Dock slots
 *
 * #dock-left and #dock-right are flex children of #main-container.
 * They are zero-width when empty and expand to hold docked panels.
 * Each slot stacks its panels vertically; the user resizes the slot
 * width by dragging its resize handle.
 * ------------------------------------------------------------------------- */
#dock-left,
#dock-right {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 0;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: #111;
    position: relative;
}

#dock-left::-webkit-scrollbar,
#dock-right::-webkit-scrollbar       { width: 4px; }
#dock-left::-webkit-scrollbar-track,
#dock-right::-webkit-scrollbar-track  { background: #111; }
#dock-left::-webkit-scrollbar-thumb,
#dock-right::-webkit-scrollbar-thumb  { background: #1c6b60; border-radius: 2px; }

#dock-left.has-panels  { width: var(--dock-left-width,  363px); min-width: 80px; }
#dock-right.has-panels { width: var(--dock-right-width, 363px); min-width: 80px; }

/* -------------------------------------------------------------------------
 * Docked panels
 *
 * Each docked panel fills its share of the slot height.
 * A resize handle between panels lets the user redistribute vertical space.
 * ------------------------------------------------------------------------- */
.dock-panel {
    flex: 0 0 auto;
    min-height: 40px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 4px;
    border: 1px solid #1c6b60;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.dock-panel-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1c6b60;
    color: #fff;
    font-size: 12px;
    font-family: Arial, sans-serif;
    padding: 0 6px;
    height: 20px;
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
}

.dock-panel-titlebar:active {
    cursor: grabbing;
}

/* Source panel fades while being dragged */
.dock-panel.dock-dragging {
    opacity: 0.35;
}

/* Ghost panel that follows the cursor during a drag */
.dock-drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    opacity: 0.85;
    border: 1px solid #3ad4b8;
    border-radius: 3px;
    background: #1c6b60;
    color: #fff;
    font-size: 12px;
    font-family: Arial, sans-serif;
    padding: 0 6px;
    height: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

/* Drop indicator line shown between panels */
.dock-drop-indicator {
    position: absolute;
    left: 4px;
    right: 4px;
    height: 2px;
    background: #3ad4b8;
    border-radius: 1px;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 4px #3ad4b8;
}

.dock-panel-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dock-panel-popout,
.dock-panel-close {
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    opacity: 0.8;
    flex-shrink: 0;
}
.dock-panel-popout:hover,
.dock-panel-close:hover {
    opacity: 1;
}

.dock-panel-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Vertical resize handle between stacked panels */
.dock-panel-resize {
    height: 6px;
    flex-shrink: 0;
    cursor: row-resize;
    background: #222;
    border-top: 1px solid #444;
    border-bottom: 1px solid #444;
}

/* Dock button injected into WinBox header via addControl() */
.wb-dock-btn {
    background-image: none !important;
    font-size: 14px;
    line-height: 1;
    opacity: 0.8;
}
.wb-dock-btn::after {
    content: '\25A3';  /* white square containing black square — embed into panel */
}
.wb-dock-btn:hover { opacity: 1; }

/* -------------------------------------------------------------------------
 * Disconnected state
 *
 * When the WebSocket is not connected, all virtual windows are grayed out
 * and pointer interaction is blocked. The class is toggled by
 * VirtualWindows.setConnected() in webclient-core.js.
 * ------------------------------------------------------------------------- */
.windows-disconnected .dock-panel {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.6);
}

.windows-disconnected .winbox {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.6);
}

/* Slot-width drag handle — flex sibling of the dock slot inside #main-container.
 * Never clipped, always grabbable. Shown only when the slot has panels. */
.dock-slot-resize {
    flex-shrink: 0;
    width: 5px;
    cursor: col-resize;
    background: #2a2a2a;
    border-left:  1px solid #1c6b60;
    border-right: 1px solid #1c6b60;
    z-index: 10;
}
.dock-slot-resize:hover,
.dock-slot-resize.dragging {
    background: #1c6b60;
}
