/* public/css/sys/windows.css - Window Manager & Controls */

/* --- Resizing Handles (jQuery UI Overrides) --- */
.ui-resizable-handle {
    position: absolute;
    font-size: 0.1px;
    display: block;
    z-index: 90;
    touch-action: none;
}
.ui-resizable-n, .ui-resizable-s { height: 7px; left: 0; right: 0; cursor: ns-resize; }
.ui-resizable-e, .ui-resizable-w { width: 7px; top: 0; bottom: 0; cursor: ew-resize; }

.ui-resizable-se {
    cursor: nwse-resize;
    right: 1px; bottom: 1px;
    width: 16px; height: 16px;
    /* Classic XP Grip Dots */
    background-image: radial-gradient(circle, #999 1px, transparent 1px);
    background-size: 4px 4px;
    background-position: bottom right;
    z-index: 100;
}
.ui-resizable-nw {
    cursor: nwse-resize;
    left: 0; top: 0;
    width: 12px; height: 12px;
    z-index: 100;
}
.ui-resizable-ne { cursor: nesw-resize; right: 0; top: 0; width: 12px; height: 12px; }
.ui-resizable-sw { cursor: nesw-resize; left: 0; bottom: 0; width: 12px; height: 12px; }


/* --- Windows --- */
.siteos-window {
    position: absolute;
    background-color: #ECE9D8;
    border: 3px solid #0055EA;
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 4px 15px rgba(0,0,0,0.4);
    overflow: hidden; /* Important for rounding */
}

/* Maximized State */
.siteos-window.maximized {
    top: 0 !important; left: 0 !important;
    width: 100% !important; height: 100% !important;
    border: none;
    border-radius: 0;
}

.siteos-window-title-bar {
    height: 28px;
    min-height: 28px; /* Strict enforcement */
    max-height: 28px; /* Strict enforcement */
    flex-shrink: 0;   /* Prevent flexbox crushing */
    background: linear-gradient(to bottom, #0058EE 0%, #3593FF 4%, #288EFF 18%, #1279E9 44%, #0369E5 100%);
    display: flex;
    align-items: center;
    padding: 0 5px;
    cursor: default; /* Handled by JS */
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
    font-weight: bold;
    user-select: none;
}
.siteos-window.active-window .siteos-window-title-bar { /* Active */ }
.siteos-window:not(.active-window) .siteos-window-title-bar {
    background: linear-gradient(to bottom, #7697E7 0%, #7E9EE3 3%, #94AFED 100%);
    color: #DDD;
}

.siteos-window-title { flex-grow: 1; margin: 0 10px; font-size: 13px; }
.siteos-window-controls { display: flex; gap: 2px; margin-right: 2px; }

.siteos-window-btn {
    width: 19px; height: 19px;
    border: 1px solid white;
    border-radius: 3px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    position: relative; /* For pseudo-elements */
    
    /* Reset text properties to avoid artifacts */
    text-shadow: none;
    text-decoration: none;
    font-weight: normal;
    font-size: 0; /* Hide any fallback text */
    line-height: 0;
}

/* Icons via CSS Shapes */
.siteos-window-btn::after {
    content: '';
    display: block;
    position: absolute;
}

/* Minimize: Low Dash */
.siteos-window-btn.minimize::after {
    width: 8px; height: 2px;
    background: white;
    bottom: 4px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.3);
}

/* Maximize: Box */
.siteos-window-btn.maximize::after {
    width: 9px; height: 9px;
    border: 2px solid white;
    border-top-width: 3px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.3);
}

/* Close: X */
.siteos-window-btn.close::after {
    width: 100%; height: 100%;
    /* Use a gradient or SVG for a clean X, or simpler transform */
    /* Simpler CSS X */
    width: 12px; height: 12px;
    background: 
        linear-gradient(45deg, transparent 40%, white 40%, white 60%, transparent 60%),
        linear-gradient(-45deg, transparent 40%, white 40%, white 60%, transparent 60%);
    /* Shadowing on the X is tricky with gradients, skipping for crispness */
    filter: drop-shadow(0 1px 0 rgba(0,0,0,0.3));
}

/* Close Button */
.siteos-window-btn.close {
    background: linear-gradient(to bottom, #E06C62 0%, #D83F36 50%, #B5291F 100%);
}
.siteos-window-btn.close:hover { filter: brightness(1.1); }
.siteos-window-btn.close:active { background: #A02018; box-shadow: inset 1px 1px 2px rgba(0,0,0,0.5); }

/* Min/Max Buttons */
.siteos-window-btn.minimize, .siteos-window-btn.maximize {
    background: linear-gradient(to bottom, #5B85D8 0%, #3566CC 100%);
    opacity: 0.9;
}
.siteos-window-btn.minimize:hover, .siteos-window-btn.maximize:hover { filter: brightness(1.1); }
.siteos-window-btn:active { box-shadow: inset 1px 1px 2px rgba(0,0,0,0.5); }


.siteos-window-content {
    flex-grow: 1;
    background: white;
    margin: 0 3px 3px 3px;
    border: 1px solid #7F9DB9;
    padding: 0;
    display: flex; 
    flex-direction: column;
    overflow: hidden; /* Prevent scrolling of the main container so dropdowns aren't clipped if they fit, 
                         but primarily we rely on inner panels scrolling. */
    position: relative;
}

/* --- Scrollable Content (e.g. external pages) --- */
.siteos-scrollable {
    overflow: auto;
    display: block; /* Override flex if necessary for simple block content */
}

/* --- XP Style Scrollbars (Webkit) --- */
.siteos-scrollable::-webkit-scrollbar {
    width: 17px;
    height: 17px;
    background-color: #ECE9D8;
}

.siteos-scrollable::-webkit-scrollbar-track {
    background-color: #ECE9D8;
    background-image: url("data:image/svg+xml,%3Csvg width='4' height='4' viewBox='0 0 4 4' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1h1v1H1V1zm2 2h1v1H3V3z' fill='%23F4F4F4' fill-opacity='0.4'/%3E%3C/svg%3E");
}

.siteos-scrollable::-webkit-scrollbar-thumb {
    background-color: #CDDDF2;
    border: 1px solid #FFF;
    border-right-color: #93B5E8;
    border-bottom-color: #93B5E8;
    border-radius: 0;
    box-shadow: inset 1px 1px 0 #FFF;
}
.siteos-scrollable::-webkit-scrollbar-thumb:hover {
    background-color: #A9C6F4;
}

.siteos-scrollable::-webkit-scrollbar-corner {
    background-color: #ECE9D8;
}

/* Scroll Buttons */
.siteos-scrollable::-webkit-scrollbar-button {
    background-color: #ECE9D8;
    width: 17px;
    height: 17px;
    border: 1px solid #FFF;
    border-right-color: #ACA899;
    border-bottom-color: #ACA899;
    box-shadow: inset 1px 1px 0 #F1EFE2, inset -1px -1px 0 #F1EFE2;
    background-repeat: no-repeat;
    background-position: center;
}
.siteos-scrollable::-webkit-scrollbar-button:active {
    box-shadow: inset 1px 1px 0 #ACA899, inset -1px -1px 0 #F1EFE2;
    background-position: center 1px;
}

/* Up Arrow */
.siteos-scrollable::-webkit-scrollbar-button:vertical:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' viewBox='0 0 7 4'%3E%3Cpath fill='%23333' d='M3.5 0L7 4H0z'/%3E%3C/svg%3E");
}
/* Down Arrow */
.siteos-scrollable::-webkit-scrollbar-button:vertical:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' viewBox='0 0 7 4'%3E%3Cpath fill='%23333' d='M0 0h7L3.5 4z'/%3E%3C/svg%3E");
}