/* MATE-style Window Manager */

.window {
    position: absolute;
    background: var(--window-bg);
    border: 1px solid var(--window-border);
    border-radius: 6px 6px 4px 4px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
    min-width: 300px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.window.inactive {
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.window.inactive .window-titlebar {
    background: var(--window-titlebar);
}

/* Window Titlebar */
.window-titlebar {
    background: var(--window-titlebar-active);
    padding: 0 8px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: default;
    border-bottom: 1px solid rgba(0,0,0,0.3);
    border-radius: 5px 5px 0 0;
    flex-shrink: 0;
}

.window-title {
    color: var(--text-light);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    flex: 1;
    padding-right: 10px;
}

.window-controls {
    display: flex;
    gap: 6px;
}

.win-btn {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 3px;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.win-btn.minimize {
    background: linear-gradient(to bottom, #e8c547 0%, #d4a82a 100%);
    color: #5a4a00;
    border: 1px solid #a08020;
}

.win-btn.minimize:hover {
    background: linear-gradient(to bottom, #f0d050 0%, #e0b830 100%);
}

.win-btn.maximize {
    background: linear-gradient(to bottom, #7eb530 0%, #5a9a20 100%);
    color: #2a4a00;
    border: 1px solid #4a8010;
}

.win-btn.maximize:hover {
    background: linear-gradient(to bottom, #90c540 0%, #6aaa30 100%);
}

.win-btn.close {
    background: linear-gradient(to bottom, #e04040 0%, #c02020 100%);
    color: #fff;
    border: 1px solid #901010;
}

.win-btn.close:hover {
    background: linear-gradient(to bottom, #f05050 0%, #d03030 100%);
}

/* Window Content */
.window-content {
    flex: 1;
    overflow: auto;
    background: #f5f5f5;
    position: relative;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    z-index: 10;
}

.resize-n {
    top: 0;
    left: 10px;
    right: 10px;
    height: 5px;
    cursor: n-resize;
}

.resize-e {
    top: 10px;
    right: 0;
    bottom: 10px;
    width: 5px;
    cursor: e-resize;
}

.resize-s {
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 5px;
    cursor: s-resize;
}

.resize-w {
    top: 10px;
    left: 0;
    bottom: 10px;
    width: 5px;
    cursor: w-resize;
}

.resize-ne {
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    cursor: ne-resize;
}

.resize-se {
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    cursor: se-resize;
}

.resize-sw {
    bottom: 0;
    left: 0;
    width: 10px;
    height: 10px;
    cursor: sw-resize;
}

.resize-nw {
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    cursor: nw-resize;
}

/* Maximized window */
.window.maximized {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0;
}

.window.maximized .window-titlebar {
    border-radius: 0;
}

.window.maximized .resize-handle {
    display: none;
}

/* Minimized window (hidden) */
.window.minimized {
    display: none;
}

/* Window animations */
.window {
    animation: windowOpen 0.15s ease-out;
}

@keyframes windowOpen {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.window.closing {
    animation: windowClose 0.1s ease-in forwards;
}

@keyframes windowClose {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Dragging state */
.window.dragging {
    opacity: 0.9;
    cursor: move;
}

.window.dragging .window-content {
    pointer-events: none;
}

/* Focus indicator for windows */
.window:focus-within {
    outline: none;
}
