/* ══════════════════════════════════════════════════
   WINDOWS.CSS — Draggable popup pencere sistemi
══════════════════════════════════════════════════ */

.win-window {
  position: fixed;
  z-index: 100;
  min-width: 280px;
  min-height: 120px;
  background: rgba(30, 24, 18, 0.96);
  border: 1px solid var(--border-bright);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255, 196, 120, 0.14);
  display: none;   /* hidden by default */
  flex-direction: column;
  backdrop-filter: blur(6px);
  transition: box-shadow 0.15s;
  overflow: hidden;
}

/* When active/focused */
.win-window.win-focused {
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(235, 160, 78, 0.4),
    0 0 24px rgba(235, 160, 78, 0.08);
  border-color: var(--border-bright);
}

/* When visible */
.win-window.win-visible {
  display: flex;
}

/* Maximized state */
.win-window.win-maximized {
  top: var(--nav-height) !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - var(--nav-height) - var(--taskbar-height)) !important;
  border-left: none;
  border-right: none;
  border-top: none;
}

/* Minimized — hidden but tracked */
.win-window.win-minimized {
  display: none !important;
}

/* Open animation */
@keyframes winOpen {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.win-window.win-visible {
  animation: winOpen 0.18s ease forwards;
}

/* ══════════════════════════════════════════════════
   TITLE BAR
══════════════════════════════════════════════════ */
.win-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 6px 0 10px;
  background: linear-gradient(
    to bottom,
    rgba(62, 47, 24, 0.98),
    rgba(42, 31, 15, 0.98)
  );
  border-bottom: 1px solid var(--border);
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
}
.win-titlebar:active { cursor: grabbing; }

/* Unfocused titlebar */
.win-window:not(.win-focused) .win-titlebar {
  background: rgba(32, 25, 16, 0.98);
}

.win-titlebar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.win-icon-small {
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
}

.win-title {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.04em;
}

/* Unfocused window title */
.win-window:not(.win-focused) .win-title {
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════
   WINDOW CONTROL BUTTONS
══════════════════════════════════════════════════ */
.win-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.win-btn {
  width: 22px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: var(--font-mono);
  border: 1px solid rgba(235, 160, 78, 0.4);
  background: rgba(38, 29, 16, 0.9);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.12s;
  line-height: 1;
  padding: 0;
}

.win-btn:hover    { background: rgba(235, 160, 78, 0.2); color: var(--amber-bright); border-color: var(--amber); }
.win-min:hover    { background: rgba(235, 160, 78, 0.2); }
.win-max:hover    { background: rgba(50, 90, 50, 0.4); border-color: #7b7; color: #9e9; }
.win-close:hover  { background: rgba(140, 40, 40, 0.7); border-color: #c55; color: #faa; }

/* ══════════════════════════════════════════════════
   WINDOW BODY
══════════════════════════════════════════════════ */
.win-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: 13.5px;
  position: relative;
}

/* Path bar (optional decorative element) */
.win-body::before {
  content: attr(data-path);
  display: block;
  font-size: 10px;
  color: var(--amber-dim);
  opacity: 0.6;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dotted rgba(212, 129, 58, 0.2);
}
.win-body:not([data-path])::before {
  display: none;
}

/* ══════════════════════════════════════════════════
   RESIZE HANDLE
══════════════════════════════════════════════════ */
.win-window {
  max-height: calc(100vh - var(--nav-height) - var(--taskbar-height) - 20px);
}

.win-window::after {
  content: '◢';
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 12px;
  color: var(--amber);
  opacity: 0.7;
  cursor: nwse-resize;
  user-select: none;
  pointer-events: none; /* handled by JS */
}
