/**
 * @file
 * FlowDrop Fullscreen Layout
 *
 * Provides immersive fullscreen layout for dashboard pages while respecting
 * Drupal's admin toolbar. This creates a seamless experience similar to
 * the FlowDrop workflow editor.
 */

/* ========================================================================
 * FULLSCREEN LAYOUT CONTAINER
 * ======================================================================== */

.fd-fullscreen-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: var(--fd-foreground);
  font-family: var(--fd-font-family-sans);
  line-height: var(--fd-line-height-normal);
}

/* Adjust for Drupal toolbar when present */
.toolbar-horizontal .fd-fullscreen-layout {
  min-height: calc(100vh - var(--fd-toolbar-height));
}

.toolbar-horizontal.toolbar-tray-open .fd-fullscreen-layout {
  min-height: calc(100vh - var(--fd-toolbar-height) - var(--fd-toolbar-tray-height));
}

/* Vertical toolbar adjustments */
.toolbar-vertical .fd-fullscreen-layout {
  margin-inline-start: 39px;
}

.toolbar-vertical.toolbar-tray-open .fd-fullscreen-layout {
  margin-inline-start: 240px;
}

/* ========================================================================
 * FULLSCREEN HEADER
 * ======================================================================== */

.fd-fullscreen-header {
  position: sticky;
  z-index: var(--fd-z-sticky);
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--fd-header-padding-y) var(--fd-header-padding-x);
  border-block-end: var(--fd-border-width) solid var(--fd-header-border);
  background-color: var(--fd-header-bg);
  box-shadow: var(--fd-header-shadow);
  gap: var(--fd-space-6);
}

/* Adjust for toolbar */
.toolbar-horizontal .fd-fullscreen-header {
  top: var(--fd-toolbar-height);
}

.toolbar-horizontal.toolbar-tray-open .fd-fullscreen-header {
  top: calc(var(--fd-toolbar-height) + var(--fd-toolbar-tray-height));
}

/* Header sections */
.fd-fullscreen-header__start {
  display: flex;
  align-items: center;
  gap: var(--fd-space-4);
}

.fd-fullscreen-header__center {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
}

.fd-fullscreen-header__end {
  display: flex;
  align-items: center;
  gap: var(--fd-space-3);
}

/* ========================================================================
 * FULLSCREEN MAIN CONTENT
 * ======================================================================== */

.fd-fullscreen-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  max-width: 100%;
  padding: var(--fd-space-6);
}

/* Constrained content width */
.fd-fullscreen-main--constrained {
  width: 100%;
  max-width: 1400px;
  margin-inline: auto;
}

/* Full width on smaller screens */
@media (max-width: 1024px) {
  .fd-fullscreen-main {
    padding: var(--fd-space-4);
  }

  .fd-fullscreen-main--constrained {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .fd-fullscreen-main {
    padding: var(--fd-space-3);
  }
}

/* ========================================================================
 * FULLSCREEN SECTIONS
 * ======================================================================== */

.fd-section {
  margin-block-end: var(--fd-space-8);
}

.fd-section:last-child {
  margin-block-end: 0;
}

.fd-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fd-space-4);
  margin-block-end: var(--fd-space-4);
}

.fd-section__title {
  margin: 0;
  color: var(--fd-foreground);
  font-size: var(--fd-text-lg);
  font-weight: var(--fd-font-weight-semibold);
}

.fd-section__description {
  margin: 0;
  margin-block-start: var(--fd-space-1);
  color: var(--fd-muted-foreground);
  font-size: var(--fd-text-sm);
}

/* ========================================================================
 * GRID LAYOUTS
 * Note: Primary grid layouts (stats, actions, cards) are now provided by
 * the flowdrop_ui_components:grid component. The classes below are kept
 * for backwards compatibility but new code should use the grid component.
 * ======================================================================== */

/* Legacy grid classes - use flowdrop_ui_components:grid component instead */
.fd-stats-grid,
.fd-actions-grid,
.fd-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--fd-space-4);
  align-items: start;
}

.fd-stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.fd-cards-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

@media (max-width: 640px) {
  .fd-stats-grid,
  .fd-actions-grid,
  .fd-cards-grid {
    grid-template-columns: 1fr;
    gap: var(--fd-space-3);
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .fd-stats-grid,
  .fd-actions-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .fd-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* Two-column layout */
.fd-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--fd-space-6);
}

@media (min-width: 1024px) {
  .fd-two-col {
    grid-template-columns: 2fr 1fr;
  }
}

/* ========================================================================
 * TOOLBAR AREA (search, filters, view toggles)
 * ======================================================================== */

.fd-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-block-end: var(--fd-space-6);
  gap: var(--fd-space-4);
}

.fd-toolbar__start {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 200px;
  gap: var(--fd-space-3);
}

.fd-toolbar__end {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
}

/* ========================================================================
 * EMPTY STATE
 * ======================================================================== */

.fd-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--fd-space-12);
  text-align: center;
}

.fd-empty-state__icon {
  width: 4rem;
  height: 4rem;
  margin-block-end: var(--fd-space-4);
  color: var(--fd-border-muted);
}

.fd-empty-state__title {
  margin: 0 0 var(--fd-space-2);
  color: var(--fd-foreground);
  font-size: var(--fd-text-lg);
  font-weight: var(--fd-font-weight-semibold);
}

.fd-empty-state__description {
  max-width: 400px;
  margin: 0 0 var(--fd-space-6);
  color: var(--fd-muted-foreground);
  font-size: var(--fd-text-sm);
}

/* ========================================================================
 * PAGE TRANSITIONS
 * ======================================================================== */

@keyframes fd-fade-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.fd-animate-in {
  animation: fd-fade-in var(--fd-transition-normal) ease-out;
}

/* Staggered animation for grid items */
.fd-stagger-in > * {
  animation: fd-fade-in var(--fd-transition-normal) ease-out backwards;
}

.fd-stagger-in > *:nth-child(1) {
  animation-delay: 0ms;
}

.fd-stagger-in > *:nth-child(2) {
  animation-delay: 50ms;
}

.fd-stagger-in > *:nth-child(3) {
  animation-delay: 100ms;
}

.fd-stagger-in > *:nth-child(4) {
  animation-delay: 150ms;
}

.fd-stagger-in > *:nth-child(5) {
  animation-delay: 200ms;
}

.fd-stagger-in > *:nth-child(6) {
  animation-delay: 250ms;
}

.fd-stagger-in > *:nth-child(n + 7) {
  animation-delay: 300ms;
}
