/**
 * @file src/ui/styles/layout.css
 * @description Master CSS Grid Layout and Progressively Disclosed Off-Canvas Drawers
 */

/* Master Layout Grid */
.vtt-layout-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

#vtt-header-hud {
  flex-shrink: 0;
}

#vtt-action-bar {
  flex-shrink: 0;
}

/* CSS Grid layout for main split */
.vtt-main-split {
  display: grid;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
  /* Columns sized by content (auto) with center taking remainder */
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "sheet center tactical";
}

/* Center Narrative Feed Column */
.vtt-narrative-center {
  grid-area: center;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: rgba(7, 10, 15, 0.85);
}

/* Character Sheet Left Sidebar Drawer */
.vtt-sheet-sidebar {
  grid-area: sheet;
  width: 440px;
  max-width: 100vw;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 10;
}

/* Right Tactical Panel Sidebar */
.vtt-tactical-sidebar {
  grid-area: tactical;
  width: 340px;
  max-width: 100vw;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 10;
}

.vtt-sheet-sidebar.collapsed,
.vtt-tactical-sidebar.collapsed {
  display: none;
}

@media (max-width: 1280px) {
  .vtt-sheet-sidebar {
    width: 380px;
  }
  .vtt-tactical-sidebar {
    width: 300px;
  }
}

/* Tablet Off-Canvas Drawers */
@media (max-width: 1024px) {
  .vtt-main-split {
    grid-template-columns: 1fr;
    grid-template-areas: "center";
  }

  /* When detached from grid, override display: none to allow transform animations */
  .vtt-sheet-sidebar,
  .vtt-tactical-sidebar {
    display: block !important;
    position: absolute;
    top: 0;
    bottom: 0;
    height: 100%;
    z-index: 100;
  }

  .vtt-sheet-sidebar {
    left: 0;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.8);
    transform: translateX(0);
  }

  .vtt-sheet-sidebar.collapsed {
    transform: translateX(-100%);
  }

  .vtt-tactical-sidebar {
    right: 0;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.8);
    transform: translateX(0);
  }
  
  .vtt-tactical-sidebar.collapsed {
    transform: translateX(100%);
  }
}

/* Mobile full width drawers */
@media (max-width: 767px) {
  .vtt-sheet-sidebar {
    width: 100vw;
  }
  .vtt-tactical-sidebar {
    width: 100vw;
  }
}
