/*
 * GSMVanta Geist adapters
 * Canonical visual adapters for the Vercel Geist CopyButton and Fieldset
 * patterns used by the PHP application. Component behavior lives in
 * assets/scripts/shared/copy-controls.js.
 */

:root {
  --geist-component-bg: #fff;
  --geist-component-bg-secondary: #fafafa;
  --geist-component-border: #eaeaea;
  --geist-component-border-strong: #d4d4d4;
  --geist-component-text: #171717;
  --geist-component-muted: #666;
  --geist-component-hover: #f2f2f2;
  --geist-component-focus: #0070f3;
  --geist-component-danger: #e5484d;
}
html:is([data-theme="dark"],[data-theme="premium-glass"]) {
  --geist-component-bg: #0a0a0a;
  --geist-component-bg-secondary: #111;
  --geist-component-border: #2e2e2e;
  --geist-component-border-strong: #444;
  --geist-component-text: #ededed;
  --geist-component-muted: #a1a1a1;
  --geist-component-hover: #1a1a1a;
  --geist-component-focus: #52a8ff;
  --geist-component-danger: #ff6166;
}

/* CopyButton -------------------------------------------------------------
   Canonical Geist-style icon button. One 32x32 control everywhere, no button
   utility classes own its geometry, no shadow, and only the glyph animates. */
.geist-copy-button {
  appearance:none;
  -webkit-appearance:none;
  box-sizing:border-box;
  position:relative;
  width:32px;
  min-width:32px;
  max-width:32px;
  height:32px;
  min-height:32px;
  max-height:32px;
  padding:0;
  margin:0;
  display:inline-grid;
  place-items:center;
  flex:0 0 32px;
  border:1px solid var(--geist-component-border);
  border-radius:6px;
  background:var(--geist-component-bg);
  color:var(--geist-component-text);
  box-shadow:none;
  font-size:0;
  line-height:1;
  text-decoration:none;
  cursor:pointer;
  overflow:hidden;
  transition:background-color .15s ease,border-color .15s ease,color .15s ease;
}
.geist-copy-button:hover:not(:disabled){
  background:var(--geist-component-hover);
  border-color:var(--geist-component-border-strong);
}
.geist-copy-button:active:not(:disabled){background:var(--geist-component-bg-secondary)}
.geist-copy-button:focus-visible{
  outline:0;
  box-shadow:0 0 0 2px var(--geist-component-bg),0 0 0 4px var(--geist-component-focus);
}
.geist-copy-button:disabled{opacity:.55;cursor:not-allowed}
.geist-copy-button>*:not(.geist-copy-button-icon):not(.geist-copy-button-status):not(.geist-copy-button-label){display:none}
.geist-copy-button-icon{
  position:relative;
  width:16px;
  height:16px;
  display:block;
  color:currentColor;
  pointer-events:none;
}
.geist-copy-button-icon svg{display:block;width:15px;height:15px}
.geist-copy-glyph{
  position:absolute;
  inset:0;
  width:16px;
  height:16px;
  display:grid;
  place-items:center;
  opacity:0;
  transform:translateY(4px) scale(.82);
  transform-origin:center;
  transition:opacity .16s ease,transform .18s cubic-bezier(.2,.8,.2,1);
}
.geist-copy-glyph-copy{opacity:1;transform:translateY(0) scale(1)}
.geist-copy-button[data-copy-state="success"] .geist-copy-glyph-copy,
.geist-copy-button[data-copy-state="error"] .geist-copy-glyph-copy{opacity:0;transform:translateY(-4px) scale(.82)}
.geist-copy-button[data-copy-state="success"] .geist-copy-glyph-success,
.geist-copy-button[data-copy-state="error"] .geist-copy-glyph-error{opacity:1;transform:translateY(0) scale(1)}
.geist-copy-button[data-copy-state="success"]{color:var(--geist-component-text)}
.geist-copy-button[data-copy-state="error"]{color:var(--geist-component-danger)}
.geist-copy-button-status{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0;
}
@media(prefers-reduced-motion:reduce){.geist-copy-glyph{transition:none}}

/* Fieldset --------------------------------------------------------------- */
.geist-fieldset {
  box-sizing: border-box;
  overflow: visible;
  border: 1px solid var(--geist-component-border) ;
  border-radius: 12px ;
  background: var(--geist-component-bg) ;
  box-shadow: none ;
}
.geist-fieldset-content {
  padding: 20px 22px ;
  background: var(--geist-component-bg) ;
}
.geist-fieldset-title {
  margin: 0 ;
  color: var(--geist-component-text) ;
  font-size: 16px ;
  font-weight:600 ;
  line-height: 1.35 ;
  letter-spacing: -.01em ;
}
.geist-fieldset-subtitle {
  margin: 4px 0 0 ;
  color: var(--geist-component-muted) ;
  font-size: 13px ;
  font-weight:400 ;
  line-height: 1.5 ;
}
.geist-fieldset-footer {
  box-sizing: border-box ;
  min-height: 52px ;
  margin: 0 ;
  padding: 9px 12px ;
  display: flex ;
  align-items: center ;
  justify-content: space-between ;
  gap: 12px ;
  border-top: 1px solid var(--geist-component-border) ;
  border-radius: 0 0 11px 11px ;
  background: var(--geist-component-bg-secondary) ;
}
.geist-fieldset-footer-status {
  min-width: 0;
  color: var(--geist-component-muted) ;
  font-size: 12px ;
  line-height: 1.45 ;
}
.geist-fieldset-footer-leading {
  min-width: 0 ;
  display: flex ;
  align-items: center ;
  flex-wrap: wrap ;
  gap: 8px ;
}
.geist-fieldset-footer-actions {
  margin-inline-start: auto ;
  display: flex ;
  align-items: center ;
  justify-content: flex-end ;
  gap: 8px ;
}
.geist-fieldset-footer-action,
.geist-fieldset-footer-actions :is(button,a,input[type="submit"]).geist-save-action {
  box-sizing: border-box ;
  width: auto ;
  min-width: 0 ;
  height: 34px ;
  min-height: 34px ;
  padding: 0 12px ;
  display: inline-flex ;
  align-items: center ;
  justify-content: center ;
  border: 1px solid #171717 ;
  border-radius: 6px ;
  background: #171717 ;
  color: #fff ;
  box-shadow: none ;
  font-size: 13px ;
  font-weight:500 ;
  line-height: 1 ;
  white-space: nowrap ;
}
.geist-fieldset-footer-action:hover,
.geist-fieldset-footer-actions :is(button,a,input[type="submit"]).geist-save-action:hover {
  background: #383838 ;
  border-color: #383838 ;
  color: #fff ;
}
html:is([data-theme="dark"],[data-theme="premium-glass"]) .geist-fieldset-footer-action,
html:is([data-theme="dark"],[data-theme="premium-glass"]) .geist-fieldset-footer-actions :is(button,a,input[type="submit"]).geist-save-action {
  border-color: #ededed ;
  background: #ededed ;
  color: #0a0a0a ;
}
html:is([data-theme="dark"],[data-theme="premium-glass"]) .geist-fieldset-footer-action:hover,
html:is([data-theme="dark"],[data-theme="premium-glass"]) .geist-fieldset-footer-actions :is(button,a,input[type="submit"]).geist-save-action:hover {
  border-color: #fff ;
  background: #fff ;
  color: #0a0a0a ;
}

/* A standalone save bar still receives the official Fieldset footer geometry. */
.geist-fieldset-footer.geist-fieldset-footer-standalone {
  border: 1px solid var(--geist-component-border) ;
  border-radius: 12px ;
}

@media (max-width: 700px) {
  .geist-fieldset-content { padding: 16px ; }
  .geist-fieldset-footer { align-items: stretch ; flex-direction: column ; }
  .geist-fieldset-footer-actions { width: 100% ; }
  .geist-fieldset-footer-actions :is(button,a,input[type="submit"]).geist-save-action { flex: 1 1 auto ; }
}


/* Preserve native hidden behavior after a save bar is enhanced. */
.geist-fieldset-footer[hidden],
.geist-fieldset-footer-standalone[hidden] { display: none ; }

/* Save actions may be direct children of an existing footer; no DOM reparenting is required. */
.geist-fieldset-footer > .geist-save-action,
.geist-fieldset-footer :is(button,a,input[type="submit"]).geist-save-action {
  box-sizing: border-box ;
  width: auto ;
  min-width: 0 ;
  height: 34px ;
  min-height: 34px ;
  padding: 0 12px ;
  margin-inline-start: auto;
  display: inline-flex ;
  align-items: center ;
  justify-content: center ;
  gap: 0 ;
  border: 1px solid #171717 ;
  border-radius: 6px ;
  background: #171717 ;
  color: #fff ;
  box-shadow: none ;
  font-size: 13px ;
  font-weight:500 ;
  line-height: 1 ;
  white-space: nowrap ;
}
.geist-fieldset-footer > .geist-save-action:hover,
.geist-fieldset-footer :is(button,a,input[type="submit"]).geist-save-action:hover {
  background: #383838 ;
  border-color: #383838 ;
  color: #fff ;
}
html:is([data-theme="dark"],[data-theme="premium-glass"]) .geist-fieldset-footer > .geist-save-action,
html:is([data-theme="dark"],[data-theme="premium-glass"]) .geist-fieldset-footer :is(button,a,input[type="submit"]).geist-save-action {
  border-color: #ededed ;
  background: #ededed ;
  color: #0a0a0a ;
}

/* Description -------------------------------------------------------------
   Reusable account/detail metadata surface based on Vercel/Geist hierarchy:
   a compact heading followed by a stable two-column key/value grid. */
.geist-description-layout {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.geist-description-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--geist-component-border);
  border-radius: 12px;
  background: var(--geist-component-bg);
  box-shadow: none;
}
.geist-description-header {
  min-height: 64px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--geist-component-border);
  background: var(--geist-component-bg);
}
.geist-description-header > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.geist-description-title {
  margin: 0;
  color: var(--geist-component-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.015em;
}
.geist-description-subtitle {
  margin: 0;
  color: var(--geist-component-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}
.geist-description-grid {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.geist-description-item {
  min-width: 0;
  min-height: 64px;
  margin: 0;
  padding: 12px 16px;
  display: grid;
  align-content: center;
  gap: 5px;
  border-bottom: 1px solid var(--geist-component-border);
}
.geist-description-item:nth-child(odd) {
  border-inline-end: 1px solid var(--geist-component-border);
}
.geist-description-item:nth-last-child(-n+2) {
  border-bottom: 0;
}
.geist-description-item dt {
  margin: 0;
  color: var(--geist-component-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}
.geist-description-item dd {
  min-width: 0;
  margin: 0;
  color: var(--geist-component-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.geist-description-item dd.geist-mono {
  font-family: var(--gv-font-mono, "Geist Mono", ui-monospace, monospace);
  font-variant-numeric: tabular-nums lining-nums;
}
.geist-description-item dd > .status {
  vertical-align: middle;
}
@media (max-width: 980px) {
  .geist-description-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .geist-description-grid { grid-template-columns: 1fr; }
  .geist-description-item:nth-child(odd) { border-inline-end: 0; }
  .geist-description-item:nth-last-child(-n+2) { border-bottom: 1px solid var(--geist-component-border); }
  .geist-description-item:last-child { border-bottom: 0; }
}

/* Copy controls in menus and result headings retain their text label. */
.geist-copy-button.geist-copy-button-labeled { display:inline-flex; align-items:center; justify-content:center; gap:8px; width:auto; min-width:72px; max-width:none; padding:0 10px; flex:0 0 auto; font-size:13px; }
.geist-copy-button-label { font:500 13px/1.3 var(--gv-font-sans,inherit); white-space:nowrap; }
.geist-copy-button[role="menuitem"] { justify-content:flex-start; width:100%; max-width:none; border:0; border-radius:4px; background:transparent; }
