/* window.css — terminal window chrome, title bar, controls, drag, genie */

/* ── Window wrapper (hidden until opened) ── */
.window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 720px;
  height: 460px;
  min-width: 480px;
  min-height: 300px;
  background: #0d0d0d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.6),
    0 8px 24px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: none;
  z-index: 100;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom center;
}

/* Visible state */
.window.open {
  display: flex;
}

/* Opening animation — genie: expand from dock */
.window.animating {
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1),
              opacity 0.4s ease;
  opacity: 1;
}

/* Closing animation — genie: compress toward dock */
.window.closing {
  transition: transform 0.4s cubic-bezier(0.55, 0, 1, 0.45),
              opacity 0.35s ease-in;
  opacity: 0;
}

/* Minimize animation — genie: swoop down to dock */
.window.minimizing {
  transition: transform 0.45s cubic-bezier(0.55, 0, 1, 0.45),
              opacity 0.35s ease-in;
  opacity: 0;
}

/* Maximized state */
.window.maximized {
  top: 24px !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - 24px) !important;
  transform: none !important;
  border-radius: 0;
  border: none;
}

/* ── Title bar (drag handle) ── */
.window-titlebar {
  height: 38px;
  min-height: 38px;
  background: rgba(30, 30, 30, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  padding: 0 12px;
  cursor: grab;
  user-select: none;
  position: relative;
}

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

/* ── Traffic light buttons ── */
.window-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

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

.window-btn:hover {
  filter: brightness(1.2);
}

.window-btn.close {
  background: #ff5f57;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}

.window-btn.minimize {
  background: #febc2e;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}

.window-btn.maximize {
  background: #28c840;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}

.window-controls:hover .window-btn.close::after {
  content: "×";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.5);
  line-height: 1;
}

.window-controls:hover .window-btn.minimize::after {
  content: "−";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.5);
  line-height: 1;
}

.window-controls:hover .window-btn.maximize::after {
  content: "+";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.5);
  line-height: 1;
}

/* ── Window title (centered in title bar) ── */
.window-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #999;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
}

/* ── Window body (scrollable content area) ── */
.window-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}

.window-body::-webkit-scrollbar {
  width: 6px;
}

.window-body::-webkit-scrollbar-track {
  background: transparent;
}

.window-body::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

/* ── Window resize handles ── */
.window-resize-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.resize-handle {
  position: absolute;
  pointer-events: auto;
}

.resize-n {
  top: -4px; left: 8px; right: 8px; height: 8px;
  cursor: n-resize;
}
.resize-s {
  bottom: -4px; left: 8px; right: 8px; height: 8px;
  cursor: s-resize;
}
.resize-e {
  right: -4px; top: 8px; bottom: 8px; width: 8px;
  cursor: e-resize;
}
.resize-w {
  left: -4px; top: 8px; bottom: 8px; width: 8px;
  cursor: w-resize;
}
.resize-ne {
  top: -4px; right: -4px; width: 12px; height: 12px;
  cursor: ne-resize;
}
.resize-nw {
  top: -4px; left: -4px; width: 12px; height: 12px;
  cursor: nw-resize;
}
.resize-se {
  bottom: -4px; right: -4px; width: 12px; height: 12px;
  cursor: se-resize;
}
.resize-sw {
  bottom: -4px; left: -4px; width: 12px; height: 12px;
  cursor: sw-resize;
}

/* ── Safari window overrides ── */
.window[data-app="safari"] {
  width: 720px;
  height: 480px;
}

.window[data-app="safari"] .window-titlebar {
  height: 52px;
  min-height: 52px;
}

/* ── Spotify window overrides ── */
.window[data-app="spotify"] {
  width: 350px;
  height: 500px;
  border-radius: 10px;
  overflow: hidden;
}

.window[data-app="spotify"] .window-body {
  border-radius: 0;
}

/* ── Shared nav button (back/forward chevrons) ── */
.nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s ease;
  padding: 0;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.18);
  transition: transform 0.06s, background 0.06s;
}

.nav-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.nav-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Lightbox variant — larger */
.nav-btn.nav-btn-lg {
  width: 36px;
  height: 36px;
}

.nav-btn.nav-btn-lg svg {
  width: 16px;
  height: 16px;
}
