/* Window Management Styles */

/* Window Container */
.window {
    position: absolute;
    min-width: 300px;
    min-height: 200px;
    background: var(--window-bg);
    border: var(--window-border);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: var(--glass-effect);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s ease;
    z-index: 100;
}

.window.active {
    z-index: 101;
    box-shadow: 0 15px 40px rgba(0, 180, 216, 0.3);
}

.window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
}

.window.minimized {
    transform: scale(0.1);
    opacity: 0;
    visibility: hidden;
}

/* Window Header */
.window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    cursor: move;
}

.window-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    flex: 1;
    margin-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.window-controls button {
    width: 24px;
    height: 24px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.window-controls button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.window-controls .close:hover {
    background: rgba(255, 0, 0, 0.5);
}

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

.window-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Window Resize Handles */
.window-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    cursor: se-resize;
}

.window-resize::before {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 5px;
    height: 5px;
    border-right: 2px solid var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

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

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

.window.opening {
    animation: windowOpen 0.2s ease-out;
}

.window.closing {
    animation: windowClose 0.2s ease-out;
}

/* Window Types */
.window.dialog {
    max-width: 500px;
    max-height: 300px;
}

.window.fullscreen {
    width: 100vw;
    height: 100vh;
    top: 0 !important;
    left: 0 !important;
}

/* Window Loading State */
.window-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--window-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.window-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--accent-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Window Groups */
.window-group {
    position: absolute;
    display: flex;
    gap: 20px;
}

.window-group.horizontal {
    flex-direction: row;
}

.window-group.vertical {
    flex-direction: column;
}

/* Window Snap Areas */
.snap-area {
    position: fixed;
    background: rgba(0, 180, 216, 0.2);
    backdrop-filter: var(--glass-effect);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.snap-area.visible {
    opacity: 1;
}

.snap-area.left {
    left: 0;
    top: 0;
    width: 50%;
    height: 100%;
}

.snap-area.right {
    right: 0;
    top: 0;
    width: 50%;
    height: 100%;
}

.snap-area.top {
    left: 0;
    top: 0;
    width: 100%;
    height: 50%;
}

.snap-area.bottom {
    left: 0;
    bottom: 0;
    width: 100%;
    height: 50%;
}
