/* ==========================================
   WebOS Reusable Window Manager Component
   ========================================== */
@import url('glass-system.css');

.webos-window {
    position: absolute;
    min-width: 360px;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: var(--z-window);
    animation: windowOpen 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--glass-shadow);
}

.webos-window.active-window {
    z-index: var(--z-window-active);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 1px var(--glass-border-light);
}

.webos-window.minimized {
    display: none !important;
}

.webos-window.maximized {
    top: 36px !important;
    left: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 36px - 80px) !important;
    border-radius: 0 !important;
}

/* Window Header Bar */
.window-header {
    height: 42px;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
    cursor: grab;
    user-select: none;
}

.window-header:active {
    cursor: grabbing;
}

/* Window Title & Icon */
.window-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.window-title img {
    width: 18px;
    height: 18px;
}

/* Window Control Buttons */
.window-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.win-btn {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: transform var(--transition-fast), filter var(--transition-fast);
}

.win-btn:hover {
    transform: scale(1.15);
    filter: brightness(1.2);
}

.win-btn-close { background: var(--btn-close); }
.win-btn-minimize { background: var(--btn-minimize); }
.win-btn-maximize { background: var(--btn-maximize); }

/* Window Body Content Container */
.window-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem;
    position: relative;
    background: rgba(15, 23, 42, 0.35);
}

/* Resizing Hitboxes */
.window-resize-handle {
    position: absolute;
    z-index: 10;
}

.resize-n { top: 0; left: 0; right: 0; height: 5px; cursor: ns-resize; }
.resize-s { bottom: 0; left: 0; right: 0; height: 5px; cursor: ns-resize; }
.resize-e { top: 0; bottom: 0; right: 0; width: 5px; cursor: ew-resize; }
.resize-w { top: 0; bottom: 0; left: 0; width: 5px; cursor: ew-resize; }
.resize-ne { top: 0; right: 0; width: 10px; height: 10px; cursor: nesw-resize; }
.resize-nw { top: 0; left: 0; width: 10px; height: 10px; cursor: nwse-resize; }
.resize-se { bottom: 0; right: 0; width: 10px; height: 10px; cursor: nwse-resize; }
.resize-sw { bottom: 0; left: 0; width: 10px; height: 10px; cursor: nesw-resize; }

@keyframes windowOpen {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(15px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
