/* ChloeOS — Window Manager Styles */

.window {
    position: absolute;
    background: var(--window-bg);
    border: 1px solid var(--window-border);
    border-radius: var(--window-radius);
    display: flex;
    flex-direction: column;
    min-width: 280px;
    min-height: 180px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: box-shadow 0.2s;
    overflow: hidden;
}

.window.focused {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent-blue);
    z-index: 100;
}

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

.window.minimized {
    display: none;
}

/* Window title bar */
.window-titlebar {
    height: 34px;
    background: var(--window-title-bg);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 8px;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
    border-bottom: 1px solid var(--ctp-surface1);
}

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

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

.window-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.window-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
    position: relative;
}
.window-btn:hover {
    filter: brightness(1.2);
    transform: scale(1.1);
}
.window-btn:active {
    transform: scale(0.95);
}

.window-btn.close {
    background: var(--btn-close);
}
.window-btn.maximize {
    background: var(--btn-maximize);
}
.window-btn.minimize {
    background: var(--btn-minimize);
}

.window-title-icon {
    font-size: 16px;
    color: var(--accent-blue);
}

.window-title-text {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.window.focused .window-title-text {
    color: var(--text-primary);
}

/* Window content area */
.window-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
    position: relative;
}

/* Resize handles */
.window .resize-handle {
    position: absolute;
    z-index: 10;
}
.resize-handle.n  { top: -3px; left: 8px; right: 8px; height: 6px; cursor: n-resize; }
.resize-handle.s  { bottom: -3px; left: 8px; right: 8px; height: 6px; cursor: s-resize; }
.resize-handle.e  { right: -3px; top: 8px; bottom: 8px; width: 6px; cursor: e-resize; }
.resize-handle.w  { left: -3px; top: 8px; bottom: 8px; width: 6px; cursor: w-resize; }
.resize-handle.ne { top: -3px; right: -3px; width: 12px; height: 12px; cursor: ne-resize; }
.resize-handle.nw { top: -3px; left: -3px; width: 12px; height: 12px; cursor: nw-resize; }
.resize-handle.se { bottom: -3px; right: -3px; width: 12px; height: 12px; cursor: se-resize; }
.resize-handle.sw { bottom: -3px; left: -3px; width: 12px; height: 12px; cursor: sw-resize; }

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

/* Navigation window specifics */
.nav-window .window-content {
    padding: 8px;
}
.nav-window ul {
    list-style: none;
    padding: 0;
}
.nav-window li {
    margin: 2px 0;
}
.nav-window .nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
}
.nav-window .nav-link:hover {
    background: var(--ctp-surface0);
    color: var(--accent-blue);
    text-decoration: none;
}
.nav-window .nav-link.active {
    background: var(--ctp-surface0);
    color: var(--accent-blue);
}
.nav-window .nav-link .material-symbols-outlined {
    font-size: 16px;
    width: 22px;
    text-align: center;
    color: var(--accent-pink);
}
.nav-window .nav-category {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    padding: 10px 10px 4px;
    font-weight: bold;
}

/* Terminal window */
.terminal-window .window-content {
    background: var(--ctp-crust);
    padding: 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: var(--accent-blue);
}
.terminal-output {
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 0;
}
.terminal-output .cmd {
    color: var(--text-primary);
}
.terminal-output .result {
    color: var(--text-secondary);
}
.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}
.terminal-prompt {
    white-space: pre;
}
.terminal-window .window-content > div {
    min-height: 100%;
    cursor: text;
}
.terminal-input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
    flex: 1;
    caret-color: transparent;
}
.terminal-cursor {
    display: inline-block;
    width: 0.6em;
    height: 1.15em;
    background: var(--accent-blue);
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
    position: absolute;
    pointer-events: none;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Oh-my-zsh style prompt segments */
.prompt-user {
    color: var(--term-green);
    font-weight: bold;
}
.prompt-at {
    color: var(--ctp-overlay1);
}
.prompt-host {
    color: var(--term-green);
    font-weight: bold;
}
.prompt-sep {
    color: var(--ctp-overlay0);
}
.prompt-dir {
    color: var(--accent-blue);
    font-weight: bold;
}
.prompt-git {
    color: var(--term-yellow);
}
.prompt-arrow {
    color: var(--accent-pink);
    font-weight: bold;
}

/* Terminal color utility classes */
.term-blue { color: var(--accent-blue); }
.term-pink { color: var(--accent-pink); }
.term-green { color: var(--term-green); }
.term-red { color: var(--term-red); }
.term-yellow { color: var(--term-yellow); }
.term-white { color: var(--ctp-text); }
.term-dim { color: var(--ctp-overlay1); }
.term-bold { font-weight: bold; }

/* Trans flag color spans for neofetch */
.term-flag-pink { color: var(--term-flag-pink); }
.term-flag-blue { color: var(--term-flag-blue); }
.term-flag-white { color: var(--term-flag-white); }

/* Window open animation */
@keyframes windowOpen {
    0% {
        opacity: 0;
        transform: scale(0.92);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Window close animation */
@keyframes windowClose {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.92);
    }
}

/* Mobile: stack windows */
@media (max-width: 768px) {
    .window {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 200px;
        left: 0 !important;
        top: 0 !important;
        border-radius: 0;
        border-left: none;
        border-right: none;
        flex-shrink: 0;
    }
    .window-titlebar {
        cursor: default;
    }
    .resize-handle {
        display: none !important;
    }
    #desktop-area {
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    .window .window-content {
        max-height: 60vh;
    }
    .window-btn.maximize {
        display: none;
    }
}
