.window {
    box-shadow: var(--window-shadow);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, background 0.3s ease;
    position: absolute;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    will-change: transform;
    z-index: 9000; /* Default z-index for windows - below menu bar */
    min-width: 300px;
    min-height: 200px;
}

.window-header {
    background: var(--menu-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    cursor: move;
    user-select: none;
}

.window.minimized {
    display: none;
}

.window.maximized {
    width: 100% !important;
    height: calc(100% - 115px) !important;
    top: 32px !important;
    left: 0 !important;
    transform: none !important;
    position: fixed !important; /* Ensure it's fixed to viewport */
    z-index: 100000 !important; /* Extremely high z-index to guarantee it's on top */
}

/* Special handling for Safari and Figma windows */
#safari-window.maximized,
#figma-window.maximized {
    width: 100% !important;
    height: calc(100% - 115px) !important;
    top: 32px !important;
    left: 0 !important;
    transform: none !important;
    position: fixed !important;
    z-index: 100000 !important; /* Extremely high z-index to guarantee it's on top */
}

.window-header .bg-red-500,
.window-header .bg-yellow-500,
.window-header .bg-green-500 {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.window-header .bg-red-500:hover,
.window-header .bg-yellow-500:hover,
.window-header .bg-green-500:hover {
    opacity: 0.8;
}

/* Resize handle styles */
.window::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 15px;
    height: 15px;
    cursor: nwse-resize;
    background-image: 
        linear-gradient(135deg, transparent 0%, transparent 75%, var(--border-color) 75%, var(--border-color) 80%, transparent 80%),
        linear-gradient(135deg, transparent 0%, transparent 65%, var(--border-color) 65%, var(--border-color) 70%, transparent 70%),
        linear-gradient(135deg, transparent 0%, transparent 55%, var(--border-color) 55%, var(--border-color) 60%, transparent 60%);
    background-size: 10px 10px;
    background-position: bottom right;
    background-repeat: no-repeat;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 99999;
}

/* Bottom-left corner */
.window::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: nesw-resize;
    background-image: 
        linear-gradient(225deg, transparent 0%, transparent 75%, var(--border-color) 75%, var(--border-color) 80%, transparent 80%),
        linear-gradient(225deg, transparent 0%, transparent 65%, var(--border-color) 65%, var(--border-color) 70%, transparent 70%),
        linear-gradient(225deg, transparent 0%, transparent 55%, var(--border-color) 55%, var(--border-color) 60%, transparent 60%);
    background-size: 10px 10px;
    background-position: bottom left;
    background-repeat: no-repeat;
    opacity: 0.5;
    transition: opacity 0.2s;
    z-index: 99999;
    pointer-events: all;
}

/* Window resize handles */
.window-resize-top,
.window-resize-left,
.window-resize-right,
.window-resize-bottom,
.window-resize-topleft,
.window-resize-topright {
    position: absolute;
    z-index: 99999;
    opacity: 0.01;
    transition: opacity 0.2s;
}

.window-resize-top {
    top: 0;
    left: 22px;
    right: 22px;
    height: 12px; /* Increased for better grab area */
    cursor: ns-resize;
    /* Extend outside the window to help catch the cursor */
    margin-top: -5px;
}

.window-resize-left {
    top: 22px;
    bottom: 22px;
    left: 0;
    width: 12px; /* Increased for better grab area */
    cursor: ew-resize;
    /* Extend outside the window to help catch the cursor */
    margin-left: -5px;
}

.window-resize-right {
    top: 22px;
    bottom: 22px;
    right: 0;
    width: 12px; /* Increased for better grab area */
    cursor: ew-resize;
    /* Extend outside the window to help catch the cursor */
    margin-right: -5px;
}

.window-resize-bottom {
    bottom: 0;
    left: 22px;
    right: 22px;
    height: 12px; /* Increased for better grab area */
    cursor: ns-resize;
    /* Extend outside the window to help catch the cursor */
    margin-bottom: -5px;
}

.window-resize-topleft {
    top: 0;
    left: 0;
    width: 20px; /* Increased for better grab area */
    height: 20px; /* Increased for better grab area */
    cursor: nwse-resize;
    /* Extend outside the window to help catch the cursor */
    margin-top: -5px;
    margin-left: -5px;
}

.window-resize-topright {
    top: 0;
    right: 0;
    width: 20px; /* Increased for better grab area */
    height: 20px; /* Increased for better grab area */
    cursor: nesw-resize;
    /* Extend outside the window to help catch the cursor */
    margin-top: -5px;
    margin-right: -5px;
}

.window-resize-top:hover,
.window-resize-left:hover,
.window-resize-right:hover,
.window-resize-bottom:hover {
    opacity: 0.3;
    background-color: var(--border-color);
}

.window-resize-topleft:hover {
    opacity: 0.3;
    background-color: var(--border-color);
    border-radius: 0 0 100% 0;
}

.window-resize-topright:hover {
    opacity: 0.3;
    background-color: var(--border-color);
    border-radius: 0 0 0 100%;
}

.window:hover::after,
.window:hover::before,
.window:hover .window-resize-top,
.window:hover .window-resize-left,
.window:hover .window-resize-right,
.window:hover .window-resize-bottom,
.window:hover .window-resize-topleft,
.window:hover .window-resize-topright {
    opacity: 0.5;
}

/* Add these styles to help visualize resizing */
.window.resize-active {
    transition: none !important;
    will-change: width, height, transform;
}

.window.resize-active .window-resize-top,
.window.resize-active .window-resize-left,
.window.resize-active .window-resize-right,
.window.resize-active .window-resize-bottom,
.window.resize-active .window-resize-topleft,
.window.resize-active .window-resize-topright {
    opacity: 0.8 !important;
    background-color: var(--border-color);
}

.window.resize-active::after,
.window.resize-active::before {
    opacity: 1;
}

/* Disable iframe pointer events during resize to prevent interference */
.window.resize-active iframe {
    pointer-events: none !important;
}

.folder-window {
    background: var(--window-bg);
}

.sidebar {
    background: var(--window-bg);
    border-right: 1px solid var(--border-color);
}

.text-gray-600 {
    color: var(--text-color-light) !important;
}

.file-icon {
    padding: 5px;
    border-radius: 5px;
    cursor: pointer;
}

.file-icon:hover {
    background-color: var(--hover-bg);
}

/* Pointer shield for capturing events even when cursor briefly leaves window */
.pointer-shield {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999999;
    background-color: transparent;
}

/* Override for window sizes when a shield is active */
.window:has(.pointer-shield) {
    min-width: 300px !important;
    min-height: 200px !important;
    max-width: 95vw !important;
    max-height: 95vh !important;
} 