/* YOUreka Tools — Carbon Design System styling.
   Depends on: @carbon/styles CSS (tokens + Carbon-styled native controls),
   IBM Plex Sans, and @carbon/web-components v2.50.0 (IBM CDN). */

/* ── base ───────────────────────────────────────────────────────────────── */
[v-cloak] { display: none; }
a { text-decoration: none; }

html { background: var(--cds-background, #161616); }
body.app {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--cds-background, #f4f4f4);
  color: var(--cds-text-primary, #161616);
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* prevent FOUC on web components */
cds-button:not(:defined), cds-tag:not(:defined), cds-tile:not(:defined),
cds-clickable-tile:not(:defined), cds-inline-notification:not(:defined),
cds-progress-bar:not(:defined) {
  visibility: hidden;
}
/* Carbon styles the shadow anchor inside tiles, not the host — give the host
   a real box so grid columns and click targets work correctly. */
cds-tile, cds-clickable-tile { display: block; }
/* an undefined modal renders its header/body/footer inline — hide it until defined */
cds-modal:not(:defined) { display: none; }

/* ── header + side nav (Carbon ui-shell) ────────────────────────────────── */
cds-header:not(:defined), cds-side-nav:not(:defined) { visibility: hidden; }
.brand-inner { display: inline-flex; align-items: center; gap: 0.5rem; }
.brand-logo { display: inline-flex; align-items: center; justify-content: center; }
.brand-logo img { display: block; }
.brand-suffix { color: var(--cds-text-secondary, #525252); font-weight: 400; }

/* the current tool is marked on the hosts (aria-current sits outside the shadow,
   so Carbon's own [aria-current=page] rule never matches) */
cds-header-nav-item[aria-current="page"] {
  border-bottom: 2px solid var(--cds-border-interactive, #0f62fe);
  font-weight: 600;
}
cds-header-nav-item[aria-current="page"]::part(link) { color: var(--cds-text-primary, #161616); }
cds-side-nav-link[aria-current="page"] {
  border-left: 3px solid var(--cds-border-interactive, #0f62fe);
  font-weight: 600;
}
cds-side-nav-link[aria-current="page"]::part(link) { color: var(--cds-text-primary, #161616); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; padding-right: 1rem; }
.header-agent { margin-left: 1rem; }
/* mobile: account actions live in the side nav, not the header */
@media (max-width: 1055px) {
  .header-right, .header-agent { display: none; }
}
/* collapsed side nav must never swallow taps meant for the header */
cds-side-nav { pointer-events: none; }
cds-side-nav[expanded] { pointer-events: auto; }
/* the side nav is a mobile affordance — desktop uses the header nav */
@media (min-width: 1056px) {
  cds-side-nav { display: none; }
}
.user-chip { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--cds-text-primary, #161616); font-size: 13px; }
.user-chip .avatar { width: 26px; height: 26px; border-radius: 50%; background: #0f62fe; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

/* logo above the mobile side-nav items */
.side-nav-brand { display: flex; align-items: center; gap: 0.75rem; padding: 2rem 1rem 1rem; color: var(--cds-text-primary, #161616); font-weight: 600; font-size: 14px; }
.side-nav-brand img { display: block; }

/* ── layout ─────────────────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1136px; margin: 0 auto; padding: 0 1.5rem; }
main.container { flex: 1 0 auto; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.narrow { max-width: 560px; }
.center-v { display: flex; flex-direction: column; justify-content: center; min-height: 70vh; }
.page-head { margin: 2.75rem auto 1.5rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5rem; font-weight: 600; margin: 0; letter-spacing: 0; }
.page-head .sub { color: var(--cds-text-secondary, #525252); margin: 0.25rem 0 0; font-size: 14px; }

/* ── panels (Carbon layer) ──────────────────────────────────────────────── */
.card, .panel, .tool-card, .message-card {
  background: var(--cds-layer, #f4f4f4);
  border: 1px solid var(--cds-border-subtle, #c6c6c6);
  border-radius: 2px;
}
.panel { padding: 1.5rem 1.75rem 1.75rem; margin-bottom: 1.25rem; }
.panel-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.step-chip {
  width: 22px; height: 22px; border-radius: 2px; flex: 0 0 auto;
  background: var(--cds-button-primary, #0f62fe); color: #fff;
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.panel-head h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.panel-head .hint { color: var(--cds-text-helper, #6f6f6f); font-size: 12px; }

/* ── hero + landing ─────────────────────────────────────────────────────── */
.hero { padding: 2.5rem 0 1.75rem; }
.hero h1 { font-size: 1.75rem; font-weight: 600; margin: 0 0 0.35rem; }
.hero p { color: var(--cds-text-secondary, #525252); max-width: 560px; margin: 0; font-size: 14px; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 960px; }
@media (max-width: 720px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-grid cds-tile { height: 100%; }
.tool-card { display: flex; flex-direction: column; padding: 1.25rem; }
.tool-card h3 { font-size: 1rem; font-weight: 600; margin: 0.75rem 0 0.3rem; }
.tool-card p { color: var(--cds-text-secondary, #525252); margin: 0 0 1rem; font-size: 14px; }
.tool-icon {
  width: 40px; height: 40px; border-radius: 4px; margin: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--cds-button-primary, #0f62fe); color: #fff;
}
.tool-icon svg { width: 20px; height: 20px; }
.tool-card .go { margin-top: auto; color: var(--cds-link, #0f62fe); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 0.3rem; }
.tool-card .go svg { width: 14px; height: 14px; }

/* ── help page ──────────────────────────────────────────────────────────── */
cds-accordion { display: block; max-width: 720px; }
.help-intro { max-width: 720px; color: var(--cds-text-secondary, #525252); margin: 0 0 1.5rem; font-size: 14px; }
.help-steps { list-style: decimal; padding-left: 1.25rem; margin: 0.5rem 0; }
.help-steps li { margin-bottom: 0.35rem; }
.help-steps li::marker { color: var(--cds-text-secondary, #525252); }
.help-note { color: var(--cds-text-secondary, #525252); font-size: 13px; max-width: 720px; }

/* ── forms (Carbon-styled native controls) ──────────────────────────────── */
label { font-weight: 400; font-size: 12px; color: var(--cds-text-secondary, #525252); margin-bottom: 0.25rem; display: block; }
.form-control {
  border: none; border-bottom: 1px solid var(--cds-border-strong, #8d8d8d);
  border-radius: 0; height: 40px; box-shadow: none;
  font-size: 14px; color: var(--cds-text-primary, #161616);
  background: var(--cds-field, #f4f4f4); padding: 0 0.75rem; width: 100%;
  appearance: auto;
}
select.form-control { padding-right: 2rem; }
.form-control:focus { outline: 2px solid var(--cds-focus, #0f62fe); outline-offset: -2px; border-bottom-color: transparent; background: var(--cds-field, #f4f4f4); }
textarea.form-control { height: auto; padding: 0.6rem 0.75rem; }

/* ── buttons (cds-button handles tool pages; these serve server pages) ──── */
.btn {
  border-radius: 0; font-weight: 400; font-size: 14px;
  padding: 0.65rem 0.95rem; border: 1px solid transparent;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; cursor: pointer;
  font-family: inherit; line-height: 1.2; text-align: center;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--cds-button-primary, #0f62fe); border-color: var(--cds-button-primary, #0f62fe); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: #0353e9; border-color: #0353e9; color: #fff; }
.btn-ghost { background: transparent; border-color: var(--cds-border-strong, #8d8d8d); color: var(--cds-text-primary, #161616); }
.btn-ghost:hover { background: var(--cds-layer-hover, #e8e8e8); color: var(--cds-text-primary, #161616); }
.btn-danger { background: var(--cds-button-danger-primary, #da1e28); border-color: var(--cds-button-danger-primary, #da1e28); color: #fff; }
.btn-danger-ghost { background: transparent; border: none; color: var(--cds-button-danger-primary, #da1e28); }
.btn[disabled], .btn.disabled { opacity: 0.5; pointer-events: none; }
.btn-block { display: flex; width: 100%; align-items: center; justify-content: center; }

/* cds-button inside flex rows */
cds-button { min-width: 0; }
cds-button::part(button) { font-size: 14px; }

/* ── badges → cds-tag; helper text ──────────────────────────────────────── */
.faint { color: var(--cds-text-helper, #6f6f6f); font-size: 12px; }
.muted { color: var(--cds-text-secondary, #525252); }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.5rem; }
.row-gap { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.flex-fill { flex: 1 1 auto; }
.form-field { margin-bottom: 0.25rem; }

/* ── details grid ───────────────────────────────────────────────────────── */
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem 1.4rem; margin: 0 0 0.25rem; }
.details > div { min-width: 0; }
.details dt { font-size: 12px; font-weight: 400; color: var(--cds-text-helper, #6f6f6f); }
.details dd { margin: 0.15rem 0 0; font-weight: 400; font-size: 14px; overflow-wrap: anywhere; }

/* ── wizard finger panels ───────────────────────────────────────────────── */
.finger-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .finger-grid { grid-template-columns: 1fr; } }
.finger { background: var(--cds-layer, #f4f4f4); border: 1px solid var(--cds-border-subtle, #c6c6c6); padding: 1rem 1.1rem 1.1rem; }
.finger.capturing { border-color: var(--cds-border-interactive, #0f62fe); box-shadow: inset 0 0 0 1px var(--cds-border-interactive, #0f62fe); }
.finger.done { background: var(--cds-layer, #f4f4f4); border-color: var(--cds-border-subtle, #c6c6c6); }
.finger-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; gap: 0.5rem; }
.finger-head h3 { font-size: 0.95rem; font-weight: 600; margin: 0; }
.finger .meta { color: var(--cds-text-helper, #6f6f6f); font-size: 12.5px; margin-top: 0.6rem; overflow-wrap: anywhere; }

/* ── cropper editor ─────────────────────────────────────────────────────── */
.editor-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 900px) { .editor-grid { grid-template-columns: 300px 1fr; align-items: start; } }
.croppa-pad {
  border: 1px solid var(--cds-border-strong, #8d8d8d);
  width: 252px; height: 270px; overflow: hidden; background: var(--cds-field, #f4f4f4);
}
.croppa-pad img { width: 250px; display: block; }
.review-options .form-check { margin-bottom: 0.35rem; }

/* ── notifications viewport (cropper toasts) ────────────────────────────── */
.toast-viewport { position: fixed; top: 3.5rem; right: 1rem; z-index: 1100; width: min(380px, calc(100vw - 2rem)); display: flex; flex-direction: column; gap: 0.5rem; }
.toast-viewport cds-inline-notification:not(:defined) { visibility: hidden; }

/* ── footer ─────────────────────────────────────────────────────────────── */
footer.foot { flex-shrink: 0; padding: 1.1rem 0 1.3rem; color: var(--cds-text-helper, #6f6f6f); font-size: 12px; border-top: 1px solid var(--cds-border-subtle, #c6c6c6); }
footer.foot .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
footer.foot a { color: var(--cds-text-secondary, #525252); }

/* ── message card (server error page) ───────────────────────────────────── */
.message-card { padding: 2.25rem 2rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.message-card h1 { font-size: 1.25rem; font-weight: 600; margin: 0; }
.message-icon { width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--cds-support-error, #da1e28); color: #fff; margin-bottom: 0.4rem; }
.message-icon.error svg { width: 24px; height: 24px; }
.message-icon.info { background: var(--cds-button-primary, #0f62fe); }
.message-card .btn { margin-top: 0.6rem; min-width: 200px; }
