/* Tiling Container Layout */
.tiling-container {
  display: flex;
  width: 100%;
  height: calc(100vh - 40px);
  gap: 0;
  transition: all 0.3s ease;
}

/* Terminal Window (fullscreen by default, shrinks when content opens) */
.terminal-window-tile {
  width: 100%;
  height: 100%;
  transition: width 0.3s ease;
  flex-shrink: 0;
}

/* When content is open, terminal shrinks to 30% */
.tiling-container.has-content .terminal-window-tile {
  width: 30%;
  min-width: 300px;
}

/* Content Container (hidden by default, 70% when visible) */
.content-container {
  width: 0;
  height: 100%;
  overflow: hidden;
  transition: width 0.3s ease;
  position: relative;
}

.tiling-container.has-content .content-container {
  width: 70%;
  overflow: visible;
}

/* Content windows stack vertically in the content area */
.content-container .window {
  width: 100%;
  height: 100%;
  max-height: 100%;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Window Styles */
.window {
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 3px solid var(--terminal-green);
  box-shadow:
    0 0 20px rgba(51, 255, 51, 0.4),
    inset 0 0 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  transition: all 0.3s;
  position: relative;
  z-index: 100;
}

.window.hidden {
  display: none;
}

/* Terminal-specific window styling */
.terminal-window-tile {
  max-height: none;
  border-right: 2px solid var(--terminal-green);
}

/* Prevent hover transform on terminal tile — it creates alignment gaps in tiled layout */
.terminal-window-tile:hover {
  transform: none;
}

.tiling-container.has-content .terminal-window-tile {
  border-right: 2px solid var(--terminal-green);
}

.window:hover {
  box-shadow:
    0 0 30px rgba(51, 255, 51, 0.6),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
}

/* Window Title Bar */
.window-titlebar {
  background: linear-gradient(to bottom,
      rgba(51, 255, 51, 0.3),
      rgba(51, 255, 51, 0.15));
  border-bottom: 2px solid var(--terminal-green);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
}

.window-title {
  font-family: var(--font-terminal);
  font-size: 18px;
  color: var(--terminal-green);
  text-transform: uppercase;
  flex: 1;
  text-align: center;
  letter-spacing: 2px;
}

/* Window Buttons */
.window-buttons {
  display: flex;
  gap: 8px;
}

.window-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--terminal-green);
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
}

.close-btn {
  background: rgba(255, 0, 0, 0.3);
}

.close-btn:hover {
  background: rgba(255, 0, 0, 0.8);
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
}

.minimize-btn {
  background: rgba(255, 176, 0, 0.3);
}

.minimize-btn:hover {
  background: rgba(255, 176, 0, 0.8);
  box-shadow: 0 0 10px rgba(255, 176, 0, 0.6);
}

.maximize-btn {
  background: rgba(51, 255, 51, 0.3);
}

.maximize-btn:hover {
  background: rgba(51, 255, 51, 0.8);
  box-shadow: 0 0 10px rgba(51, 255, 51, 0.6);
}

/* Window Content */
.window-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  background: rgba(10, 10, 10, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .tiling-container {
    flex-direction: column;
  }

  /* Terminal fullscreen on mobile by default */
  .terminal-window-tile {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* Hide terminal when a content window is open */
  .tiling-container.has-content .terminal-window-tile {
    display: none !important;
  }

  /* Content container fullscreen on mobile */
  .content-container {
    width: 100% !important;
    height: 100% !important;
  }

  .tiling-container.has-content .content-container {
    width: 100% !important;
    height: 100% !important;
  }

  /* Ensure content windows take full height */
  .content-container .window {
    height: 100%;
    max-height: 100%;
  }
}