/* HFAI Cloud — application shell (separate page). Reuses tokens from styles.css. */

body.hc-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(166, 134, 237, 0.10), transparent 60%),
    radial-gradient(700px 480px at -5% 40%, rgba(237, 112, 187, 0.08), transparent 60%),
    var(--bg);
}

/* Some of our elements set display:flex, which would beat the hidden attribute. */
.hc-body [hidden] { display: none !important; }

.hc-app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

/* --- Sidebar (OpenRouter-style) ---------------------------------------- */
.hc-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 16px;
  background: #0c0a11;
  border-right: 1px solid #241c2f;
}

.hc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  padding: 4px 6px 6px;
}
.hc-brand img { width: 30px; height: 30px; border-radius: 8px; }
.hc-brand .hc-cloud { color: var(--pink); }

.hc-wallet {
  border: 1px solid #34263f;
  border-radius: 11px;
  background: #130e1b;
  padding: 13px 13px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.hc-wallet-top { display: flex; align-items: center; gap: 8px; font-size: .74rem; letter-spacing: .06em; color: #9b8aaaff; text-transform: uppercase; }
.hc-mode { margin-left: auto; font-size: .6rem; letter-spacing: .08em; color: #c8afcf; border: 1px solid #4b3c50; border-radius: 999px; padding: 2px 8px; }
.hc-tier { align-self: flex-start; font-size: .68rem; letter-spacing: .06em; color: #ffd7a1; border: 1px solid #6f5636; background: #ffd7a112; border-radius: 999px; padding: 3px 10px; }
.cloud-convo { position: relative; }
.cloud-convo-del { position: absolute; top: 7px; right: 8px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: .7rem; line-height: 1; color: #8a7c9b; opacity: 0; transition: opacity .15s, color .15s, background .15s; cursor: pointer; }
.cloud-convo:hover .cloud-convo-del, .cloud-convo.active .cloud-convo-del { opacity: 1; }
.cloud-convo-del:hover { color: #ff9db4; background: #ff9db41a; }
.cloud-convo-del.confirm { width: auto; padding: 0 6px; font-size: .62rem; letter-spacing: .04em; color: #ff9db4; background: #ff9db41a; opacity: 1; }
.cloud-error { color: #ff9db4; font-size: .84rem; }
.hc-wallet-addr { font-family: var(--display); font-size: .95rem; color: #ecd6ee; }
.hc-wallet-credits { display: flex; align-items: baseline; justify-content: space-between; }
.hc-wallet-credits span { font-size: .72rem; color: #8a7c9b; }
.hc-wallet-credits strong { font-family: var(--display); color: #8ef0c4; font-size: 1.05rem; }
.hc-wallet-actions { display: flex; gap: 8px; }
.hc-wallet-actions .button { min-height: 38px; padding: 8px 12px; font-size: .8rem; flex: 1; }

.hc-nav { display: flex; flex-direction: column; gap: 3px; }
.hc-nav-group { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: #6f6488; padding: 14px 10px 6px; }
.hc-nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: none;
  color: #b7a8c6;
  border-radius: 9px;
  padding: 10px 11px;
  font-size: .87rem;
  font-weight: 500;
  transition: background .16s, color .16s, border-color .16s;
}
.hc-nav button svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.hc-nav button:hover { background: #ffffff06; color: #ecd6ee; }
.hc-nav button.active { background: #b064981f; border-color: #4a3556; color: #f2cae9; }
.hc-nav button.active svg { opacity: 1; }
.hc-nav .hc-badge { margin-left: auto; font-size: .62rem; color: #f2cae9; background: #b0649826; border: 1px solid #6d4770; border-radius: 999px; padding: 1px 7px; }

.hc-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid #241c2f; }
.hc-side-foot a, .hc-side-foot button {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: none; color: #9b8aaa; text-align: left;
  padding: 9px 11px; border-radius: 8px; font-size: .82rem; width: 100%;
}
.hc-side-foot a:hover, .hc-side-foot button:hover { background: #ffffff06; color: #ecd6ee; }

/* --- Main -------------------------------------------------------------- */
.hc-main { min-width: 0; display: flex; flex-direction: column; }
.hc-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 15px 30px;
  border-bottom: 1px solid #241c2f;
  background: #09080eee;
  backdrop-filter: blur(16px);
}
.hc-topbar h1 { font-family: var(--display); font-size: 1.15rem; font-weight: 600; margin: 0; letter-spacing: -0.02em; }
.hc-topbar .hc-sub { color: #8a7c9b; font-size: .82rem; }
.hc-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 11px; }
.hc-account-chip { display: flex; align-items: center; gap: 8px; border: 1px solid #34263f; border-radius: 999px; padding: 6px 12px; font-size: .78rem; color: #c9b6d6; background: #130e1b; }
.hc-account-chip .hc-dot-live { width: 7px; height: 7px; border-radius: 50%; background: #8ef0c4; box-shadow: 0 0 8px #8ef0c4aa; }

.hc-content { padding: 30px; max-width: 1180px; width: 100%; }
.hc-view { display: none; }
.hc-view.active { display: block; animation: hc-fade .25s ease; }
@keyframes hc-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hc-view-head { margin-bottom: 24px; }
.hc-view-head h2 { font-family: var(--display); font-size: 1.9rem; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 8px; }
.hc-view-head p { color: #a79db4; font-size: .95rem; margin: 0; max-width: 680px; line-height: 1.7; }

/* --- Stats / cards ----------------------------------------------------- */
.hc-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 26px; }
.hc-stat { border: 1px solid #34263f; border-radius: 12px; background: #130e1b; padding: 18px 18px 16px; }
.hc-stat span { font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: #8a7c9b; }
.hc-stat strong { display: block; font-family: var(--display); font-size: 1.7rem; color: #ecd6ee; margin-top: 8px; letter-spacing: -0.02em; }
.hc-stat small { color: #8a7c9b; font-size: .76rem; }

.hc-panel { border: 1px solid #34263f; border-radius: 12px; background: #130e1b; padding: 22px; }
.hc-panel + .hc-panel { margin-top: 18px; }
.hc-panel h3 { font-family: var(--display); font-size: 1.1rem; margin: 0 0 6px; }
.hc-panel > p { color: #a79db4; font-size: .88rem; margin: 0 0 16px; line-height: 1.7; }

/* --- Loading / empty / error states ------------------------------------ */
.hc-skel { position: relative; overflow: hidden; background: #241a2e; border-radius: 6px; }
.hc-skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, #ffffff12, transparent); animation: hc-shimmer 1.3s infinite; }
@keyframes hc-shimmer { to { transform: translateX(100%); } }
.hc-skel-line { display: block; height: 12px; }
.hc-skel-block { height: 100%; min-height: 120px; border-radius: 10px; }
.hc-skel-rail { height: 42px; margin-bottom: 6px; }
.hc-skel-row td { padding: 11px 10px 11px 0; border-bottom: 1px solid #241a2e; }
.hc-skel-stat span, .hc-skel-stat strong, .hc-skel-stat small { display: block; }
.hc-skel-stat strong { margin-top: 8px; height: 22px; }
.hc-skel-stat small { margin-top: 8px; }
.hc-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 26px 16px; text-align: center; }
.hc-state-msg { color: #8a7c9b; font-size: .86rem; }
.hc-state-error .hc-state-msg { color: #ff9db4; }
.hc-retry { border: 1px solid #4a3556; border-radius: 8px; background: #17111d; color: #e6d2ec; padding: 7px 16px; font-size: .8rem; transition: border-color .16s, background .16s; }
.hc-retry:hover { border-color: #b87ca8; background: #b0649826; }

/* usage sparkline */
.hc-spark { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 8px 4px 0; }
.hc-spark .hc-bar { flex: 1; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #ff6fd8, #8a4fb0); min-height: 4px; opacity: .85; }
.hc-spark-labels { display: flex; gap: 6px; margin-top: 8px; }
.hc-spark-labels span { flex: 1; text-align: center; font-size: .64rem; color: #6f6488; }

/* credits */
.hc-topup-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.hc-amount { border: 1px solid #4a3556; border-radius: 10px; background: #17111d; color: #e6d2ec; padding: 16px 14px; text-align: left; transition: border-color .16s, background .16s; }
.hc-amount:hover { border-color: #b87ca8; }
.hc-amount.active { border-color: #bd7da9; background: #b0649826; }
.hc-amount strong { display: block; font-family: var(--display); font-size: 1.3rem; }
.hc-amount small { color: #8a7c9b; font-size: .72rem; }

/* --- Gate -------------------------------------------------------------- */
.hc-gate { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 26px; background: radial-gradient(ellipse at 50% 0%, #4a245a55, transparent 60%), #0b0810f5; backdrop-filter: blur(9px); }
.hc-gate[hidden] { display: none; }
.hc-gate-card { width: min(470px,100%); text-align: center; border: 1px solid #5a3d62; border-radius: 18px; background: linear-gradient(150deg,#1b1224,#110d18); padding: 38px 32px; box-shadow: 0 34px 90px #0008; }
.hc-gate-badge { display: inline-flex; align-items: center; gap: 7px; font-size: .68rem; letter-spacing: .12em; color: #d29bc8; border: 1px solid #5a3d62; border-radius: 999px; padding: 6px 13px; margin-bottom: 20px; }
.hc-gate-card h2 { font-family: var(--display); font-size: 1.95rem; line-height: 1.2; margin: 0 0 14px; color: #eedaef; }
.hc-gate-card > p { font-size: .92rem; line-height: 1.75; color: #ab9db8; margin: 0 0 22px; }
.hc-gate-actions { display: flex; gap: 11px; justify-content: center; flex-wrap: wrap; }
.hc-gate-actions .button { min-width: 184px; }
.hc-gate-status { font-size: .83rem; color: #b7a8c6; margin: 18px 0 0; min-height: 20px; }
.hc-gate-status.ok { color: #8ef0c4; }
.hc-gate-status.err { color: #ff9db4; }
.hc-gate-note { font-size: .78rem; color: #8a7c9b; margin: 14px 0 0; }
.hc-gate-demo { color: #e0b0e0; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: #79517c; font-size: inherit; background: none; border: 0; }
.hc-gate-wallets { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.hc-gate-wallets img { width: 22px; height: 22px; border-radius: 6px; }

/* chat view reuses .cloud-* from styles.css, but fills the shell */
.hc-view[data-view="chat"] .cloud-app { min-height: 620px; }

@media (max-width: 900px) {
  .hc-app { grid-template-columns: 1fr; }
  .hc-sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px; border-right: 0; border-bottom: 1px solid #241c2f; }
  .hc-wallet { flex: 1 1 220px; }
  .hc-nav { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .hc-nav-group { display: none; }
  .hc-side-foot { margin: 0; flex-direction: row; width: 100%; padding-top: 0; border-top: 0; }
  .hc-content { padding: 20px; }
  .hc-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hc-topup-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .hc-topbar { padding: 12px 16px; }
  .hc-topbar .hc-sub { display: none; }
  .hc-content { padding: 16px; }
  .hc-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hc-stat { padding: 14px; }
  .hc-stat strong { font-size: 1.35rem; }
  .hc-view-head h2 { font-size: 1.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hc-view.active { animation: none; }
}
