/* Shared interface rules for the operator and applicant interfaces. */
@import './scrollbars.css';

:root {
  --status-padding: 2px .375rem;
  --status-radius: 6px;
  --status-font-size: .6875rem;
  --status-line-height: 1.3;
  --status-gap: 4px;
  --status-dot-size: 5px;
  --motion-quick: 180ms;
  --motion-standard: 320ms;
  --motion-panel: 360ms;
  --motion-ease: cubic-bezier(0.2, 0.75, 0.2, 1);
}

:where(button, a, input, select, textarea, summary) {
  transition: color var(--motion-quick) ease,
    background-color var(--motion-quick) ease,
    border-color var(--motion-quick) ease,
    box-shadow var(--motion-quick) ease;
}
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 3px;
}

/* The same logo and motion are used for page, inline and button feedback. */
:where(.is-processing, .capture-progress, .workspace[data-stage="waiting"] #status[data-polling], button[aria-busy="true"])::before {
  content: "";
  display: inline-block;
  flex: none;
  inline-size: var(--cr-loader-size, 1rem);
  block-size: var(--cr-loader-size, 1rem);
  margin-inline-end: .45em;
  vertical-align: -.22em;
  background: url('/assets/brand/paytiko-mark-96.png') center / contain no-repeat;
  /* Center the visible mark inside its transparent image. */
  transform-origin: 50.7% 56%;
  translate: -.7% -6%;
}

:where(.loading, #status).is-processing { --cr-loader-size: 1.75rem; }
.loading.is-processing { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.loading.is-processing::before, .capture-progress::before, #route-loading::before { margin-inline-end: 0; }
button[aria-busy="true"] > .cr-icon { display: none; }

@keyframes crystal-ready-loader {
  0% { transform: rotate(0turn); }
  88%, 100% { transform: rotate(1turn); }
}

@media (prefers-reduced-motion: no-preference) {
  :where(.is-processing, .capture-progress, .workspace[data-stage="waiting"] #status[data-polling], button[aria-busy="true"])::before {
    animation: crystal-ready-loader 2.05s cubic-bezier(.45, 0, .35, 1) infinite;
  }
}

@keyframes surface-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes page-enter {
  from { opacity: 0.45; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@keyframes feedback-enter {
  from {
    opacity: 0;
    translate: 0 5px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .page-enter {
    animation: page-enter var(--motion-standard) var(--motion-ease);
  }
  .detail-tab-content > *,
  .welcome:not([hidden]),
  #form-area:not([hidden]),
  #ownership-area:not([hidden]),
  #complete:not([hidden]) {
    animation: surface-enter var(--motion-standard) var(--motion-ease);
  }
  .toast:not([hidden]),
  .column-menu,
  .task-progress[open] ol {
    animation: feedback-enter 220ms var(--motion-ease);
  }
}

/* Native dialog lifecycle keeps focus handling and Escape behavior intact. */
@supports (transition-behavior: allow-discrete) {
  dialog {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 240ms ease,
      transform var(--motion-panel) var(--motion-ease),
      display var(--motion-panel) allow-discrete,
      overlay var(--motion-panel) allow-discrete;
  }
  dialog.drawer {
    transform: translateX(24px);
  }
  dialog[open] {
    opacity: 1;
    transform: none;
  }
  dialog::backdrop {
    opacity: 0;
    transition: opacity 240ms ease,
      display var(--motion-panel) allow-discrete,
      overlay var(--motion-panel) allow-discrete;
  }
  dialog[open]::backdrop {
    opacity: 1;
  }
  @starting-style {
    dialog[open] {
      opacity: 0;
      transform: translateY(8px);
    }
    dialog.drawer[open] {
      transform: translateX(24px);
    }
    dialog[open]::backdrop {
      opacity: 0;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Shared Carbon icons use solid path geometry, not scaled illustration strokes. */
svg.cr-icon{display:inline-block;fill:currentColor;stroke:none;vertical-align:middle;flex-shrink:0}
.country-display {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  max-width: 100%;
  vertical-align: middle;
}
.country-flag {
  flex: none;
  width: 24px;
  height: 18px;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--ui-border);
}
