/*
 * Formero Client Portal - styles
 * © 2026 Sergio Romero. All rights reserved.
 * Same palette and HUD look as 3DLiteView.
 */

@font-face { font-family: "Roboto"; src: url("../fonts/Roboto-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("../fonts/Roboto-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("../fonts/Roboto-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --bg: #0b0b0c;
  --cyan: #2ed3c6;
  --cyan-glow: rgba(46, 211, 198, 0.35);
  --magenta: #ff2db4;
  --amber: #ffb020;
  --bone: #f4f2ee;
  --gray: #3a3f44;
  --muted: #9aa3a8;
  --ok: #98eb34;
  --line: rgba(46, 211, 198, 0.28);
  --panel: rgba(11, 11, 12, 0.78);
  --r: 2px;
}

* { box-sizing: border-box; }
html {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 50% 30%, rgba(58, 63, 68, 0.45) 0%, rgba(11, 11, 12, 0.97) 70%),
    linear-gradient(rgba(44, 246, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(44, 246, 255, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 41.4px 41.4px, 41.4px 41.4px;
  background-attachment: fixed;
  min-height: 100%;
}
body {
  margin: 0;
  color: var(--bone);
  font: 15px/1.5 Roboto, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--cyan); }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: 0.01em; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); margin-bottom: 12px; }
h3 { font-size: 18px; }
.thin { font-weight: 400; color: var(--muted); }
.kicker { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.18em; color: var(--cyan); font-weight: 500; }
.small { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.meta { color: var(--muted); margin: 6px 0 0; font-size: 14px; }

/* ---- header / footer ---- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 11, 12, 0.85);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { height: 26px; width: auto; display: block; }
.brand-tag { font-size: 11px; letter-spacing: 0.22em; color: var(--bone); border-left: 1px solid var(--line); padding-left: 14px; }
.who { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--muted); }
.who[hidden] { display: none; }
main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 40px; }
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 16px clamp(16px, 4vw, 40px);
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}

/* ---- buttons / inputs ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 13px/1 Roboto, Arial, sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--cyan); background: rgba(11, 11, 12, 0.75);
  border: 1px solid var(--cyan); border-radius: var(--r);
  padding: 11px 16px; cursor: pointer; text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn:hover { background: rgba(46, 211, 198, 0.12); box-shadow: 0 0 10px var(--cyan-glow); }
.btn.primary { background: var(--cyan); color: var(--bg); font-weight: 700; }
.btn.primary:hover { background: #4fe3d7; }
.btn.small { padding: 8px 11px; font-size: 11.5px; }
.btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.link { background: none; border: 0; padding: 0; color: var(--cyan); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type="email"], input[inputmode], input#soName {
  width: 100%; padding: 12px 14px; font: 16px Roboto, Arial, sans-serif; color: var(--bone);
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--gray); border-radius: var(--r); outline: none;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---- panels / login ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; }
.narrow { max-width: 460px; margin: 6vh auto 0; }
.login form .btn { width: 100%; margin-top: 16px; }
.login .link { display: block; margin: 14px auto 0; }
.sub { color: var(--muted); margin: 8px 0 4px; }
.error { color: var(--magenta); font-size: 13px; margin: 8px 0 0; }
.demo { margin: 22px 0 0; padding-top: 14px; border-top: 1px dashed var(--gray); font-size: 12.5px; color: var(--muted); }
#code { letter-spacing: 0.4em; text-align: center; font-size: 22px; }

/* ---- chips / states ---- */
.chip {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em;
  padding: 4px 8px; border: 1px solid currentColor; border-radius: var(--r);
}
.chip.t-wip { color: var(--cyan); }
.chip.t-renders { color: var(--magenta); }
.chip.t-final { color: var(--amber); }
.status { font-size: 12.5px; font-weight: 500; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--amber); }
.status.new { color: var(--magenta); }
.status.new::before { content: "● "; }
.status.muted { color: var(--muted); }
.expiry { font-size: 12px; color: var(--muted); margin-left: 8px; }
.expiry.soon { color: var(--amber); }
.dl-state { font-size: 12.5px; color: var(--muted); }
.dl-state.ok { color: var(--ok); }

/* ---- home ---- */
.intro { margin-bottom: 26px; }
.project { margin-bottom: 30px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 18px; text-decoration: none; color: var(--bone);
  background: var(--panel); border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--r);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card.t-wip { border-left-color: var(--cyan); }
.card.t-renders { border-left-color: var(--magenta); }
.card.t-final { border-left-color: var(--amber); }
.card:hover { box-shadow: 0 0 14px var(--cyan-glow); transform: translateY(-1px); }
.card .chip { align-self: flex-start; }
.card .meta { margin: 0; font-size: 13px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.06); }

/* ---- delivery ---- */
.crumbs { margin-bottom: 18px; }
.crumbs.bottom { margin: 28px 0 0; }
/* clear way back to the list of deliveries */
.btn.back { gap: 10px; padding: 10px 16px 10px 12px; color: var(--bone); border-color: var(--bone); }
.btn.back span { display: inline-block; font-size: 17px; line-height: 1; margin-top: -3px; color: var(--cyan); transition: transform 0.15s; }
.btn.back:hover { border-color: var(--cyan); color: var(--cyan); }
.btn.back:hover span { transform: translateX(-3px); }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 18px; }
.head h1 { margin-top: 10px; }
.head-actions { text-align: right; flex-shrink: 0; }
.note {
  margin: 14px 0 0; padding: 12px 14px; max-width: 760px;
  border-left: 2px solid var(--cyan); background: rgba(46, 211, 198, 0.06); color: var(--bone);
}
.note span { display: block; font-size: 10.5px; letter-spacing: 0.16em; color: var(--cyan); margin-bottom: 4px; }

.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 14px 16px; margin-bottom: 20px; border: 1px solid; border-radius: var(--r); font-size: 14px;
}
.banner b { letter-spacing: 0.12em; font-size: 12px; }
.banner span { flex: 1 1 320px; }
.banner.warn { border-color: var(--amber); background: rgba(255, 176, 32, 0.08); }
.banner.warn b { color: var(--amber); }
.banner.ok { border-color: var(--ok); background: rgba(152, 235, 52, 0.07); }
.banner.ok b { color: var(--ok); }

.workspace { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 18px; margin-bottom: 30px; }
.pieces ul { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.piece { position: relative; background: var(--panel); border: 1px solid var(--gray); border-radius: var(--r); transition: border-color 0.15s; }
/* square picture of the piece, top right */
.p-thumb {
  position: absolute; top: 10px; right: 10px; width: 64px; height: 64px;
  display: grid; place-items: center; overflow: hidden; pointer-events: none;
  border: 1px solid var(--gray); border-radius: var(--r);
  background: radial-gradient(circle at 50% 40%, rgba(58, 63, 68, 0.7), rgba(3, 8, 11, 0.95));
}
.p-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.p-thumb i { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); }
.p-thumb.wait i { animation: thumbPulse 1.2s ease-in-out infinite; }
.p-thumb.solid { border-style: dashed; }
.p-thumb.solid i { color: var(--amber); }
.piece.on .p-thumb { border-color: var(--cyan); }
@keyframes thumbPulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .p-thumb.wait i { animation: none; } }
/* hidden copy of the viewer that draws the thumbnails */
.thumb-frame { position: fixed; left: -10000px; top: 0; width: 480px; height: 480px; border: 0; opacity: 0; pointer-events: none; }
.piece.on { border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan-glow); }
.p-main {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; width: 100%;
  min-height: 84px; padding: 12px 86px 8px 14px; align-content: flex-start; background: none; border: 0; color: inherit; text-align: left; cursor: pointer; font: inherit;
}
.p-main:disabled { cursor: default; }
.p-name { font-weight: 700; font-size: 15px; word-break: break-word; }
.p-sub { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.piece.solid .p-sub { color: var(--amber); }
.fmts { display: inline-flex; gap: 4px; }
.fmts i { font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; padding: 2px 6px; border-radius: var(--r); background: var(--gray); color: var(--bone); }
.p-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 12px; }

.viewer-box { min-width: 0; }
.viewer-wrap {
  position: relative; height: min(72vh, 680px); min-height: 360px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r); background: #03080b;
}
.viewer-wrap iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; }
.viewer-msg {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(3, 8, 11, 0.82); color: var(--cyan); font-size: 14px; letter-spacing: 0.04em; pointer-events: none;
}
.viewer-msg.show { display: flex; }
.viewer-msg .bar { display: block; width: 200px; height: 3px; background: linear-gradient(to right, var(--cyan) var(--p), var(--gray) var(--p)); }
.viewer-hint { text-align: center; }

.gallery-sec { margin-bottom: 30px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.gallery figure { margin: 0; background: var(--panel); border: 1px solid var(--gray); border-radius: var(--r); overflow: hidden; }
.thumb { display: block; width: 100%; padding: 0; border: 0; background: #000; cursor: zoom-in; aspect-ratio: 4 / 3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery figcaption { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; }
.g-name { font-size: 13px; font-weight: 500; word-break: break-all; }
.gallery figcaption .btn { align-self: flex-start; }

.history ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.history li { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 6px 0 6px 16px; position: relative; font-size: 13.5px; }
.history li::before { content: ""; position: absolute; left: -4px; top: 13px; width: 7px; height: 7px; background: var(--cyan); transform: rotate(45deg); }
.history time { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- dialogs ---- */
dialog { color: var(--bone); border: 1px solid var(--line); border-radius: var(--r); background: #0e1012; padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
.signoff { width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.signoff form { padding: 24px; }
.signoff h2 { color: var(--bone); font-size: 22px; letter-spacing: 0; text-transform: none; margin-bottom: 12px; }
.ack { padding: 14px; border: 1px solid var(--amber); background: rgba(255, 176, 32, 0.06); border-radius: var(--r); margin: 0 0 14px; }
.so-files { font-size: 13px; }
.so-files ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); max-height: 140px; overflow: auto; }
.so-files li span { opacity: 0.7; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--bone); font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--cyan); flex-shrink: 0; }
.so-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.lightbox { width: min(1200px, calc(100vw - 24px)); background: #000; }
.lightbox img { display: block; width: 100%; max-height: calc(100vh - 110px); object-fit: contain; }
.lb-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 10px; font-size: 13px; color: var(--muted); }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 12px 16px; font-size: 13.5px;
  background: #0e1012; border: 1px solid var(--cyan); border-radius: var(--r); box-shadow: 0 0 16px var(--cyan-glow);
  transition: opacity 0.2s, transform 0.2s; z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- small screens ---- */
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .viewer-box { order: -1; }
  .viewer-wrap { height: 62vh; min-height: 320px; }
  .head { flex-direction: column; }
  .head-actions { text-align: left; }
  .head-actions .btn { width: 100%; }
}
@media (max-width: 520px) {
  h1 { font-size: 23px; }
  .brand-tag { display: none; }
  .who span { display: none; }
  .history li { grid-template-columns: 1fr; gap: 0; }
}
