/* ============================================
   FIDEM Layout
   Single screen, responsive breakpoints
   ============================================ */

/* --- App shell --- */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* --- Screen (each view) --- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal),
              visibility var(--transition-normal);
  pointer-events: none;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  will-change: opacity;
}

/* --- Screen sections --- */
.screen-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-sm);
}

.screen-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen-footer {
  flex-shrink: 0;
  padding: var(--space-md) 0;
}

/* --- Desktop card wrapper --- */
@media (min-width: 1024px) {
  body {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(
      ellipse at center,
      var(--surface) 0%,
      var(--bg) 70%
    );
    z-index: -1;
  }

  #app {
    width: var(--max-width);
    max-height: 900px;
    height: 100dvh;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
  }
}

/* --- Tablet --- */
@media (min-width: 481px) and (max-width: 1023px) {
  .screen {
    padding: var(--space-lg);
  }

  .screen-body {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
  }
}

/* --- Mobile (base) --- */
@media (max-width: 480px) {
  .screen {
    padding: var(--space-sm);
  }
}

/* --- Grid helpers --- */
.row {
  display: flex;
  gap: var(--space-md);
  width: 100%;
}

.row-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.col {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
}

.col-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

/* --- Spacers --- */
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* --- Text alignment --- */
.text-center { text-align: center; }
.text-left { text-align: left; }

/* --- Full width --- */
.w-full { width: 100%; }

/* --- Global fixed toolbar --- */
.global-toolbar {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: var(--z-sticky);
  display: flex;
  gap: var(--space-xs);
}
