/* =============================================================================
   WRM LIVING STUDIO OS: WINDOW CHROME & CONTROLS
   Liquid Glass Frame, Vector Controls, Drag Shields
   ============================================================================= */

.windows-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 30px;
  pointer-events: none;
  z-index: var(--z-windows);
}

@media (max-width: 768px) {
  .windows-container {
    bottom: 40px;
  }
}

.os-window {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  min-width: 380px;
  min-height: 260px;
  overflow: hidden;
  background: #ece9d8;
  border: 3px solid #0055eb;
  border-top: none;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), inset 1px 0 0 rgba(255, 255, 255, 0.4), inset -1px -1px 0 rgba(0, 0, 0, 0.2);
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.os-window.active {
  border-color: #0055eb;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75), inset 1px 0 0 rgba(255, 255, 255, 0.5);
}

.os-window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100% - 30px) !important;
  border-radius: 0 !important;
  border: none !important;
}

@media (max-width: 768px) {
  .os-window.maximized {
    height: calc(100% - 40px) !important;
  }
}

/* Authentic Win95 Scope Override */
body.theme-win95 .os-window {
  background-color: var(--w95-gray, #c0c0c0);
  border: 2px solid #ffffff;
  border-right-color: #000000;
  border-bottom-color: #000000;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080, 2px 2px 8px rgba(0, 0, 0, 0.35);
  border-radius: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.theme-win95 .os-window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100% - 28px) !important;
  border: none !important;
}

/* Window Titlebar */
.window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 8px 0 10px;
  user-select: none;
  cursor: default;
  background: linear-gradient(180deg, #7697c7 0%, #8caad8 8%, #7697c7 93%, #5f7aa4 100%);
  border-radius: 6px 6px 0 0;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #d8e4f8;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7);
}

.os-window.active .window-titlebar {
  background: linear-gradient(180deg, #0058ee 0%, #3593ff 4%, #288eff 6%, #0058ee 8%, #0055eb 12%, #0058ee 93%, #00309c 100%);
  color: #ffffff;
  text-shadow: 1px 1px 1px #001f66;
}

body.theme-win95 .window-titlebar {
  height: 24px;
  padding: 2px 4px;
  background: linear-gradient(90deg, #808080 0%, #b5b5b5 100%);
  color: #dfdfdf;
  font-family: Tahoma, sans-serif;
  font-size: 11px;
  font-weight: 700;
  border-bottom: none;
}

body.theme-win95 .os-window.active .window-titlebar {
  background: linear-gradient(90deg, #000080 0%, #1084d0 100%);
  color: #ffffff;
}

.window-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1;
}

.window-icon-svg svg {
  width: 16px;
  height: 16px;
  display: block;
}

.window-title-text {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-tag {
  font-family: Tahoma, sans-serif;
  font-size: 10px;
  opacity: 0.85;
  font-weight: 400;
  color: #e0f2fe;
}

/* Window Controls */
.window-controls {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}

.win-btn {
  width: 21px;
  height: 21px;
  border-radius: 3px;
  background: linear-gradient(180deg, #3882f6 0%, #1e40af 100%);
  border: 1px solid #ffffff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: filter 0.1s ease;
  padding: 0;
}

.win-btn svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.5;
}

.win-btn:hover {
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  filter: brightness(1.1);
}

.win-btn:active {
  background: #1d4ed8;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.win-btn:focus-visible {
  box-shadow: 0 0 0 2px #ffffff;
}

.win-btn-close {
  background: linear-gradient(180deg, #e06c56 0%, #c43722 100%);
  border-color: #ffffff;
}

.win-btn-close:hover {
  background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
  filter: brightness(1.15);
}

.win-btn-close:active {
  background: #991b1b;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7);
}

body.theme-win95 .win-btn {
  width: 16px;
  height: 14px;
  background: #c0c0c0;
  border: 1px solid #ffffff;
  border-right-color: #000000;
  border-bottom-color: #000000;
  border-radius: 0;
  font-size: 9px;
  font-weight: 700;
  color: #000000;
}

/* Window Action Menubar */
.window-menubar {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
  font-family: var(--font-mono);
  position: relative;
  gap: 12px;
}

.win-menu-dropdown {
  position: relative;
}

.win-menu-label {
  padding: 3px 8px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  color: var(--ink-secondary);
  transition: all var(--duration-fast) ease;
}

.win-menu-label:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-primary);
}

.win-menu-items {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-surface-elevated);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass-highlight);
  border-radius: var(--radius-sm);
  min-width: 180px;
  z-index: 100;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  padding: 4px 0;
}

.win-menu-dropdown:hover .win-menu-items {
  display: block;
}

.win-menu-item {
  padding: 6px 14px;
  cursor: pointer;
  color: var(--ink-primary);
  font-size: 11px;
  transition: background var(--duration-fast) ease;
}

.win-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.win-menu-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.window-menu-meta {
  margin-left: auto;
  font-size: 10px;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-pill {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-glass);
}

/* Window Content Body (Clear and unblurred) */
.window-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #0c0e14;
  display: flex;
  flex-direction: column;
}

.window-content-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  flex: 1;
}

.window-menubar,
.window-statusbar {
  flex-shrink: 0;
}

.window-iframe-wrap {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.window-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  display: block;
  background: #090b10;
}

/* Temporary Drag & Resize Iframe Shield */
.window-iframe-shield {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  pointer-events: auto;
  background: transparent;
}

.os-window.is-dragging .window-iframe-shield,
.os-window.is-resizing .window-iframe-shield {
  display: block;
}

.window-loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 4px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(56, 189, 248, 0.3);
  pointer-events: none;
}

/* Window Status Bar */
.window-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--ink-dim);
}

.status-col {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-dot.live { background: var(--accent-emerald); box-shadow: 0 0 6px var(--accent-emerald); }
.status-dot.ref { background: var(--accent-cyan); box-shadow: 0 0 6px var(--accent-cyan); }

.window-resize-handle {
  font-size: 9px;
  cursor: nwse-resize;
  opacity: 0.5;
  padding: 2px;
}
