/* =========================================================
   ultraIA — Design System
   Marca: preto + degradê ciano→azul | tipografia Poppins
   feito por Samuel Costa
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;0,800;1,500&display=swap');

:root {
  /* base (paleta da marca) */
  --bg:        #000000;   /* color-1 */
  --bg-2:      #05080c;
  --surface:   #0a0f15;   /* tom de superfície (color-2 a confirmar) */
  --surface-2: #111923;
  --line:      #1a2532;
  --line-soft: #121a24;

  --text:      #f1f6fa;
  --text-2:    #9eb0c0;
  --text-3:    #5d6e7c;

  /* acentos da marca */
  --cyan:      #50c8dc;   /* color-3 */
  --blue:      #288cc8;   /* color-4 */
  --blue-2:    #1e82be;   /* color-5 */
  --accent:    #288cc8;
  --accent-2:  #50c8dc;
  --accent-dim:#0f2c3a;
  --grad:      linear-gradient(95deg, #50c8dc 0%, #288cc8 55%, #1e82be 100%);

  --danger:    #ef6f7b;
  --ok:        #57c9a6;

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 24px 60px -20px rgba(0,0,0,.8);
  --shadow-sm: 0 10px 30px -14px rgba(0,0,0,.7);

  --display: 'Poppins', system-ui, sans-serif;
  --sans:    'Poppins', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  background-image:
    radial-gradient(1100px 560px at 88% -12%, rgba(80,200,220,.12), transparent 60%),
    radial-gradient(900px 520px at -10% 112%, rgba(30,130,190,.10), transparent 58%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; opacity: .035; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--sans); cursor: pointer; }

.eyebrow {
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  font-weight: 600;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Marca / wordmark ---------- */
.brand { display: flex; flex-direction: column; gap: 1px; line-height: 1.05; }
.logo {
  font-weight: 800; font-size: 1.45rem; letter-spacing: -.02em; color: var(--text);
}
.logo .ia {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.byline { font-size: .66rem; color: var(--text-3); letter-spacing: .02em; font-weight: 500; }
.byline b { color: var(--text-2); font-weight: 600; }
.brand-hero .logo { font-size: 2.3rem; }
.brand-hero .byline { font-size: .78rem; }

/* ---------- Layout central (login) ---------- */
.auth-wrap { position: relative; z-index: 1; min-height: 100%; display: grid; place-items: center; padding: 2rem 1.25rem; }

.card {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.4rem 2.2rem;
}
.card .brand { margin-bottom: 2rem; align-items: flex-start; }

h1.title { font-family: var(--display); font-weight: 700; font-size: 1.85rem; line-height: 1.12; letter-spacing: -.02em; margin-bottom: .5rem; }
.subtitle { color: var(--text-2); font-size: .94rem; margin-bottom: 1.8rem; }

/* ---------- Form ---------- */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-2); margin-bottom: .45rem; letter-spacing: .01em; }
.input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: .8rem .95rem; font-size: .95rem; font-family: var(--sans);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(80,200,220,.18); background: var(--bg-2); }

.btn {
  width: 100%; border: none; border-radius: var(--radius-sm); padding: .85rem 1rem;
  font-weight: 600; font-size: .95rem; letter-spacing: .01em; color: #fff;
  background: var(--grad);
  transition: transform .08s ease, box-shadow .2s, filter .15s;
  box-shadow: 0 12px 28px -12px rgba(40,140,200,.7);
}
.btn:hover { filter: brightness(1.07); box-shadow: 0 16px 34px -12px rgba(80,200,220,.6); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.25); }

.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line); box-shadow: none; }
.btn-ghost:hover { color: var(--text); border-color: var(--cyan); filter: none; }
.btn-sm { width: auto; padding: .6rem .95rem; font-size: .85rem; }

.msg { font-size: .85rem; padding: .7rem .85rem; border-radius: var(--radius-sm); margin-bottom: 1rem; display: none; }
.msg.show { display: block; }
.msg.error { background: rgba(239,111,123,.12); color: var(--danger); border: 1px solid rgba(239,111,123,.3); }
.msg.ok    { background: rgba(87,201,166,.12); color: var(--ok); border: 1px solid rgba(87,201,166,.3); }

.foot-note { margin-top: 1.4rem; font-size: .8rem; color: var(--text-3); text-align: center; }

/* ---------- App shell ---------- */
.shell { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.6rem; border-bottom: 1px solid var(--line-soft);
  background: rgba(0,0,0,.55); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.topbar .user { display: flex; align-items: center; gap: .9rem; }
.user .email { font-size: .85rem; color: var(--text-2); }
.user .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2);
  border: 1px solid var(--line); display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; color: var(--cyan);
}

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 2.6rem 1.6rem 4rem; }
.page-head { margin-bottom: 2.2rem; }
.page-head h1 { font-family: var(--display); font-weight: 700; font-size: 2.1rem; letter-spacing: -.02em; }
.page-head p { color: var(--text-2); margin-top: .5rem; max-width: 60ch; }

.alert {
  display: flex; align-items: center; gap: .9rem;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--accent-dim); border-left: 3px solid var(--cyan);
  border-radius: var(--radius-sm); padding: .95rem 1.1rem; margin-bottom: 2rem;
  font-size: .9rem; color: var(--text-2);
}
.alert b { color: var(--text); }
.alert a { color: var(--cyan); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; }

.tool {
  position: relative; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; min-height: 168px; overflow: hidden;
  transition: transform .14s ease, border-color .2s, box-shadow .2s;
}
.tool::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .25s;
  background: radial-gradient(420px 220px at 90% -20%, rgba(80,200,220,.16), transparent 60%);
}
.tool:not(.disabled):hover { transform: translateY(-3px); border-color: var(--blue); box-shadow: var(--shadow-sm); }
.tool:not(.disabled):hover::after { opacity: 1; }

.tool .ico {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  font-size: 1.2rem; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 1rem;
}
.tool h3 { font-size: 1.06rem; font-weight: 700; letter-spacing: -.01em; }
.tool p { color: var(--text-2); font-size: .87rem; margin-top: .35rem; flex: 1; }
.tool .go { margin-top: 1rem; font-size: .82rem; color: var(--cyan); font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.tool.disabled { opacity: .5; cursor: default; }
.badge {
  position: absolute; top: 1.1rem; right: 1.1rem; font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; font-weight: 700; padding: .25rem .55rem; border-radius: 999px;
  background: var(--surface-2); color: var(--text-3); border: 1px solid var(--line);
}
.tool.config-card { border-style: dashed; }

.panel {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; max-width: 640px;
}
.key-status { display: flex; align-items: center; gap: .6rem; font-size: .85rem; margin-top: 1rem; color: var(--text-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(87,201,166,.18); }
.row { display: flex; gap: .7rem; margin-top: 1.1rem; flex-wrap: wrap; }
.help { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px solid var(--line-soft); font-size: .85rem; color: var(--text-2); line-height: 1.7; }
.help ol { margin: .6rem 0 0 1.1rem; }
.help a { color: var(--cyan); font-weight: 600; }
.help code { background: var(--surface-2); padding: .05rem .35rem; border-radius: 5px; font-size: .82em; }
.input-key { display: flex; gap: .5rem; }
.input-key .input { flex: 1; }
.icon-btn { background: var(--bg); border: 1px solid var(--line); color: var(--text-2); border-radius: var(--radius-sm); padding: 0 .85rem; font-size: .85rem; }
.icon-btn:hover { color: var(--text); border-color: var(--cyan); }

.back-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--text-2); font-size: .85rem; margin-bottom: 1.4rem; }
.back-link:hover { color: var(--cyan); }

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -2px; }
@keyframes rot { to { transform: rotate(360deg); } }

.reveal { opacity: 0; transform: translateY(10px); animation: up .5s ease forwards; }
.reveal:nth-child(2){animation-delay:.05s} .reveal:nth-child(3){animation-delay:.1s}
.reveal:nth-child(4){animation-delay:.15s} .reveal:nth-child(5){animation-delay:.2s}
@keyframes up { to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  .topbar { padding: .85rem 1.1rem; }
  .user .email { display: none; }
  .container { padding: 2rem 1.1rem 3rem; }
  .page-head h1 { font-size: 1.7rem; }
  .card { padding: 2rem 1.5rem; }
  .brand-hero .logo { font-size: 2rem; }
}
