/* ==========================================================================
   PhotonOS - Window Manager Styling
   ========================================================================== */

#window-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - var(--taskbar-height));
    pointer-events: none;
}

.os-window {
    position: absolute;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-backdrop-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--window-border-radius);
    box-shadow: var(--shadow-window);
    overflow: hidden;
    min-width: 260px;
    min-height: 180px;
    transition: box-shadow var(--transition-fast), opacity 0.2s ease, transform 0.2s ease;
}

.os-window.focused {
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 229, 255, 0.25);
}

.os-window.minimized {
    opacity: 0;
    transform: scale(0.6) translateY(200px);
    pointer-events: none !important;
}

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

/* Titlebar */
.window-titlebar {
    height: 38px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    cursor: grab;
    user-select: none;
}

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

.os-window.focused .window-titlebar {
    background: rgba(255, 255, 255, 0.08);
}

.window-title-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.window-icon {
    font-size: 16px;
}

/* Window Controls (Minimize, Maximize, Close) */
.window-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.window-control-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.08);
    transition: all var(--transition-fast);
}

.window-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.window-control-btn.btn-close:hover {
    background: var(--accent-danger);
    color: #fff;
}

.window-control-btn.btn-minimize:hover {
    background: var(--accent-warning);
    color: #000;
}

.window-control-btn.btn-maximize:hover {
    background: var(--accent-success);
    color: #000;
}

/* Window Content Body */
.window-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(10, 12, 24, 0.85);
}

/* Window Resizers */
.window-resizer {
    position: absolute;
    z-index: 100;
}

.window-resizer.r-right { top: 0; right: 0; width: 6px; height: 100%; cursor: e-resize; }
.window-resizer.r-left { top: 0; left: 0; width: 6px; height: 100%; cursor: w-resize; }
.window-resizer.r-bottom { bottom: 0; left: 0; width: 100%; height: 6px; cursor: s-resize; }
.window-resizer.r-bottom-right { bottom: 0; right: 0; width: 12px; height: 12px; cursor: se-resize; }
.window-resizer.r-bottom-left { bottom: 0; left: 0; width: 12px; height: 12px; cursor: sw-resize; }

/* Windows 98 Retro Window Styling */
body.theme-win98 .os-window {
    background: #c0c0c0 !important;
    border-radius: 0 !important;
    border-top: 2px solid #ffffff !important;
    border-left: 2px solid #ffffff !important;
    border-right: 2px solid #000000 !important;
    border-bottom: 2px solid #000000 !important;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: none !important;
    padding: 2px !important;
}

body.theme-win98 .os-window.focused {
    border-color: #000000 !important;
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.7) !important;
}

body.theme-win98 .window-titlebar {
    background: linear-gradient(90deg, #000080, #1084d0) !important;
    color: #ffffff !important;
    height: 24px !important;
    padding: 0 4px !important;
    border-radius: 0 !important;
    border-bottom: none !important;
    font-family: 'Tahoma', 'Segoe UI', sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
}

body.theme-win98 .os-window:not(.focused) .window-titlebar {
    background: linear-gradient(90deg, #808080, #b5b5b5) !important;
    color: #c0c0c0 !important;
}

body.theme-win98 .window-title-info {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: inherit !important;
}

body.theme-win98 .window-controls {
    gap: 3px !important;
}

body.theme-win98 .window-control-btn {
    width: 16px !important;
    height: 14px !important;
    background: #c0c0c0 !important;
    border-top: 1px solid #ffffff !important;
    border-left: 1px solid #ffffff !important;
    border-right: 1px solid #404040 !important;
    border-bottom: 1px solid #404040 !important;
    border-radius: 0 !important;
    color: #000000 !important;
    font-size: 9px !important;
    font-weight: 700 !important;
}

body.theme-win98 .window-control-btn:hover {
    background: #e0e0e0 !important;
    color: #000000 !important;
}

body.theme-win98 .window-body {
    border-top: 2px solid #808080 !important;
    border-left: 2px solid #808080 !important;
    border-right: 2px solid #ffffff !important;
    border-bottom: 2px solid #ffffff !important;
    background: #000000 !important;
}
