﻿/* =========================
   XLII Forge — base styles
   ========================= */

:root{
  --bg0:#07080c;
  --bg1:#0b0d14;
  --panel:#0f1320cc;
  --panel2:#0d101a;
  --line:#1f2741;
  --text:#e9ecf4;
  --muted:#a6afc6;
  --accent:#6d86ff;
  --good:#39d98a;
  --warn:#ffcc66;
  --bad:#ff5c7a;

  --r12:12px;
  --r16:16px;

  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New";
}

*{box-sizing:border-box}
body{
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% 20%, rgba(109,134,255,.18), transparent 60%),
              radial-gradient(900px 700px at 80% 30%, rgba(57,217,138,.12), transparent 60%),
              linear-gradient(180deg, var(--bg0), var(--bg1));
}

.mono{font-family:var(--mono)}
/* links */
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}

/* Root container */
.forge{
  padding: 10px;
  gap: 10px;
}

/* Topbar */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r16);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  box-shadow: var(--shadow);
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:700;
}
.badge{
  font-size:12px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,.04);
}
.dot{
  width:10px;height:10px;border-radius:50%;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(57,217,138,.15);
}

/* Buttons */
.actions{display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end}
.btn{
  cursor:pointer;
  font-family: var(--font);
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{ background: rgba(255,255,255,.07); border-color: rgba(109,134,255,.45); }
.btn:active{ transform: translateY(1px); }
.btn.primary{
  background: rgba(109,134,255,.18);
  border-color: rgba(109,134,255,.55);
}
.btn.good{
  background: rgba(57,217,138,.16);
  border-color: rgba(57,217,138,.55);
}
.btn.danger{
  background: rgba(255,92,122,.14);
  border-color: rgba(255,92,122,.55);
}

/* Tabs */
.tabs{
  display:flex;
  gap:8px;
  padding: 8px;
  border:1px solid var(--line);
  border-radius: var(--r16);
  background: rgba(255,255,255,.03);
  overflow:auto;
}
.tab{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border:1px solid transparent;
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  color: var(--muted);
  user-select:none;
}
.tab:hover{ background: rgba(255,255,255,.06); color: var(--text); }
.tab.active{
  background: rgba(109,134,255,.16);
  border-color: rgba(109,134,255,.55);
  color: var(--text);
}
.tab.dirty::after{
  content:"•";
  color: var(--warn);
  margin-left: 4px;
  font-weight: 900;
}
.tab .x{
  margin-left: 6px;
  opacity:.8;
}
.tab .x:hover{opacity:1}

/* Main split */
.main{
  gap: 10px;
}

/* Sidebar */
.sidebar{
  border:1px solid var(--line);
  border-radius: var(--r16);
  background: rgba(15,19,32,.65);
  box-shadow: var(--shadow);
  padding: 10px;
}
.sidebarHeader{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding-bottom: 10px;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.sidebarHeader h3{
  margin:0;
  font-size: 14px;
  color: var(--text);
}
.sidebarBtns{display:flex; flex-wrap:wrap; gap:8px}

/* Explorer */
.group{ margin-top:10px; }
.folder{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  cursor:pointer;
  user-select:none;
  border:1px solid rgba(255,255,255,.05);
}
.folder:hover{ background: rgba(255,255,255,.06); }
.files{ padding: 8px 0 0 0; }
.group:not(.open) .files{ display:none; }

.file{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 7px 10px;
  margin-top: 6px;
  border-radius: 12px;
  cursor:pointer;
  border:1px solid rgba(255,255,255,.04);
  background: rgba(255,255,255,.02);
  color: var(--muted);
}
.file:hover{ background: rgba(255,255,255,.06); color: var(--text); }
.file.active{
  background: rgba(109,134,255,.16);
  border-color: rgba(109,134,255,.55);
  color: var(--text);
}

/* Editor wrap */
.editorWrap{
  border:1px solid var(--line);
  border-radius: var(--r16);
  background: rgba(15,19,32,.50);
  box-shadow: var(--shadow);
  overflow:hidden;
}

/* Bottom panel */
.bottomPanel{
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(10,12,18,.85);
}
.bottomHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding: 10px 12px;
}
.bottomBody{
  padding: 10px 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

/* Status footer */
.status{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 10px 12px;
  border:1px solid var(--line);
  border-radius: var(--r16);
  background: rgba(255,255,255,.03);
  color: var(--muted);
}

/* Toast */
.toast{
  position: fixed;
  right: 18px;
  bottom: 18px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events:none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(15,19,32,.92);
  box-shadow: var(--shadow);
  color: var(--text);
  transition: opacity .15s ease, transform .15s ease;
}
.toast.show{
  opacity: 1;
  transform: translateY(0);
}

/* =========
   Layout hard-fix (o teu)
   ========= */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* tira scroll da página */
}

#app { height: 100%; }

.forge {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* impede vazamentos */
}

/* topbar / tabs / status não devem forçar scroll */
.topbar, .tabs, .status { flex: 0 0 auto; }

/* área central deve cortar e deixar scroll só onde interessa */
.main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;     /* CRÍTICO em flex layouts */
  overflow: hidden;
}

/* sidebar com scroll interno */
.sidebar {
  flex: 0 0 320px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tree {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;    /* scroll só aqui */
}

/* editorWrap também precisa permitir o Monaco encolher/crescer */
.editorWrap {
  flex: 1 1 auto;
  min-width: 0;      /* CRÍTICO */
  min-height: 0;     /* CRÍTICO */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* monaco host ocupa tudo o que sobra */
.editorHost {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

/* bottom panel */
.bottomPanel {
  flex: 0 0 auto;
  height: 0;
  overflow: hidden;
}

.bottomPanel.show {
  height: 260px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bottomBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  white-space: pre-wrap;
}

/* timer row */
.timerRow {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.brandLogo{
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  margin-right: 10px;
  vertical-align: middle;
  opacity: .95;
}
