/**
 * @file
 * FlowDrop Dashboard Layout
 *
 * Provides the page layout for FlowDrop admin dashboard pages.
 * Unlike fullscreen-layout, this does not take over the full viewport —
 * it fits naturally within the Drupal admin theme while applying FlowDrop
 * design tokens and adjusting for the admin toolbar.
 */

/* ========================================================================
 * DASHBOARD LAYOUT CONTAINER
 * ======================================================================== */

.fd-dashboard-layout {
  display: flex;
  flex-direction: column;
  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-vertical .fd-dashboard-layout {
  margin-inline-start: 39px;
}

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

/* ========================================================================
 * MAIN CONTENT AREA
 * ======================================================================== */

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

.fd-dashboard-main--constrained {
  width: 100%;
  max-width: 1400px;
  margin-inline: auto;
}

@media (max-width: 1024px) {
  .fd-dashboard-main {
    padding: var(--fd-space-4);
  }

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

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

/* ========================================================================
 * 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
 * ======================================================================== */

.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;
}

.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;
}
