/* === OS-like Window Styles === */

.app-window {
    position: absolute;
    min-width: 220px;
    min-height: 160px;
    background: rgba(15, 15, 25, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    z-index: 100;
}

.app-window.focused {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent);
    z-index: 500;
}

.app-window.gesture-hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.app-window.gesture-grabbed {
    border-color: var(--success);
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.3);
    opacity: 0.9;
}

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

.app-window.minimizing {
    animation: minimize-out 0.3s ease forwards;
}

.app-window.restoring {
    animation: minimize-in 0.3s ease forwards;
}

@keyframes minimize-out {
    to {
        transform: scale(0.1);
        opacity: 0;
    }
}

@keyframes minimize-in {
    from {
        transform: scale(0.1);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* === Window Title Bar === */
.window-titlebar {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 0.75rem;
    background: rgba(10, 10, 18, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: default;
    flex-shrink: 0;
}

.window-titlebar-buttons {
    display: flex;
    gap: 6px;
    margin-right: 0.75rem;
}

.win-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    position: relative;
    transition: filter 0.15s;
}

.win-btn:hover {
    filter: brightness(1.3);
}

.win-btn svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    opacity: 0;
    transition: opacity 0.15s;
}

.window-titlebar:hover .win-btn svg {
    opacity: 1;
}

.win-btn-close {
    background: var(--danger);
}

.win-btn-close svg {
    stroke: #450a0a;
}

.win-btn-minimize {
    background: var(--warning);
}

.win-btn-minimize svg {
    stroke: #451a03;
}

.win-btn-maximize {
    background: var(--success);
}

.win-btn-maximize svg {
    stroke: #052e16;
}

.window-title {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

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

/* === Window Content === */
.window-content {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Content types */
.window-content.type-note {
    padding: 0;
}

.window-content.type-note textarea {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    border: none;
    padding: 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

.window-content.type-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.clock-time {
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.clock-date {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.window-content.type-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.window-content.type-list ul {
    list-style: none;
    padding: 0;
}

.window-content.type-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.window-content.type-list li:last-child {
    border-bottom: none;
}

.window-content.type-chart {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    padding-bottom: 2rem;
}

.chart-bar {
    width: 24px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(to top, var(--accent), #a78bfa);
    transition: height 0.5s ease;
    position: relative;
}

.chart-bar::after {
    content: attr(data-label);
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.window-content.type-weather {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.weather-icon {
    font-size: 3rem;
}

.weather-temp {
    font-size: 2rem;
    font-weight: 700;
}

.weather-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Draw window */
.window-content.type-draw {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.draw-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(10, 10, 18, 0.4);
    flex-shrink: 0;
}

.draw-colors {
    display: flex;
    gap: 4px;
}

.draw-color {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
    padding: 0;
}

.draw-color:hover {
    transform: scale(1.15);
}

.draw-color.active {
    border-color: white;
}

.draw-sizes {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.draw-size {
    padding: 0.15rem 0.4rem;
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.65rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.draw-size.active {
    background: var(--accent);
    color: white;
}

.draw-clear {
    padding: 0.15rem 0.4rem;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.draw-clear:hover {
    background: rgba(239, 68, 68, 0.3);
}

.draw-canvas {
    flex: 1;
    display: block;
    cursor: crosshair;
    background: rgba(0, 0, 0, 0.3);
}

.draw-hint {
    padding: 0.3rem 0.6rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    background: rgba(10, 10, 18, 0.4);
    text-align: center;
    flex-shrink: 0;
}

.draw-hint kbd {
    background: rgba(255,255,255,0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-family: inherit;
}

.draw-hint.drawing-active {
    color: var(--success);
}

.window-content.type-color {
    padding: 0;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 100%;
}

.color-swatch {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.15s;
}

.color-swatch:hover {
    filter: brightness(1.2);
}

/* === Resize Handle === */
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}

.resize-handle::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--border-light);
    border-bottom: 2px solid var(--border-light);
    opacity: 0;
    transition: opacity var(--transition);
}

.app-window:hover .resize-handle::after {
    opacity: 1;
}

/* === Window Snap Indicators === */
.snap-indicator {
    position: absolute;
    background: var(--accent-glow);
    border: 2px dashed var(--accent);
    border-radius: var(--radius);
    z-index: 50;
    pointer-events: none;
    transition: all 0.2s ease;
    opacity: 0;
}

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

/* === Status Bar === */
.window-statusbar {
    height: 24px;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(10, 10, 18, 0.4);
}
