/* css/components.css
 * Componentes reutilizáveis: botões retrô, barras de progresso, toasts MSN,
 * diálogos, pop-ups, BonziBuddy, partículas de clique, toolbars e Tela Azul.
 */

/* ---------- Botão XP ---------- */
.xp-btn {
  min-width: 74px; padding: 4px 12px; font-size: 12px; color: #000; cursor: pointer; border: 1px solid #003c74; border-radius: 3px;
  background: linear-gradient(#fff, #ece9d8 85%, #d6d0c5); box-shadow: inset 0 0 0 1px #fff;
}
.xp-btn:hover:not(:disabled) { box-shadow: inset 0 0 0 2px #f8b636; }
.xp-btn:active:not(:disabled) { background: #d6d0c5; box-shadow: inset 1px 1px 3px rgba(0,0,0,.4); }
.xp-btn:disabled { color: #8a8a80; border-color: #a8a79c; cursor: default; }
.xp-btn.default { border-width: 2px; }
.xp-btn.big { padding: 7px 14px; font-weight: bold; }
.xp-btn.mini { min-width: 0; padding: 2px 8px; font-size: 11px; }
.xp-btn.danger { color: #8a1a1a; }
.xp-btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

/* ---------- Barra de progresso XP ---------- */
.xp-progress { position: relative; height: 18px; padding: 2px; background: #fff; border: 1px solid #686868; border-radius: 3px; overflow: hidden; }
.xp-progress.big { height: 26px; }
.xp-progress.mini { height: 12px; width: 90px; }
.xp-progress-fill {
  height: 100%; width: 0; border-radius: 2px;
  background: repeating-linear-gradient(90deg, #36c030 0 8px, transparent 8px 10px);
  background-color: transparent; transition: width .2s linear;
}
.xp-progress.mid .xp-progress-fill { background: repeating-linear-gradient(90deg, #e8c020 0 8px, transparent 8px 10px); }
.xp-progress.low .xp-progress-fill { background: repeating-linear-gradient(90deg, #e03a2a 0 8px, transparent 8px 10px); }
.xp-progress.low { animation: low-pulse .8s steps(2) infinite; }
.xp-progress.frozen .xp-progress-fill { background: repeating-linear-gradient(90deg, #8aa 0 8px, transparent 8px 10px); }
@keyframes low-pulse { 50% { box-shadow: 0 0 0 2px #e03a2a; } }

/* ---------- Cartões e utilidades ---------- */
.card { background: #fff; border: 1px solid #b9c7e0; border-radius: 6px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.card h3 { margin: 0 0 8px; font-size: 13px; color: #1a3fa8; border-bottom: 1px solid #dbe4f5; padding-bottom: 4px; }
input[type="text"], select, textarea { font: inherit; padding: 3px 5px; border: 1px solid #7f9db9; background: #fff; border-radius: 2px; user-select: text; -webkit-user-select: text; }
input[type="range"] { width: 100%; }

/* ---------- Toasts (MSN) ---------- */
.toast { border: 1px solid #1b49b8; border-radius: 6px; overflow: hidden; background: #fff; box-shadow: 2px 3px 10px rgba(0,0,0,.5); animation: toast-in .35s ease-out; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }
.toast.clickable { cursor: pointer; }
.toast-head { display: flex; justify-content: space-between; align-items: center; padding: 3px 6px; font-size: 11px; color: #fff; background: linear-gradient(#2a66d8, #1b4bb8); }
.toast-x { border: 0; background: none; color: #fff; font-size: 16px; cursor: pointer; line-height: 1; }
.toast-body { display: flex; gap: 8px; padding: 8px; background: linear-gradient(#fff, #e8f0fb); }
.toast-ico { width: 34px; height: 34px; }
.toast-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toast-text span { color: #333; word-break: break-word; }
@keyframes toast-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ---------- Diálogos e pop-ups ---------- */
.window.dialog, .window.popup-win { height: auto; }
.dlg { padding: 14px 16px 10px; background: var(--xp-beige); }
.dlg-main { display: flex; gap: 12px; align-items: flex-start; }
.dlg-ico { width: 38px; height: 38px; }
.dlg-text p { margin: 0 0 6px; white-space: pre-wrap; font-size: 12.5px; }
.dlg-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.popup { padding: 10px 12px 12px; background: #fff7d6; }
.popup-main { display: flex; gap: 10px; align-items: flex-start; }
.popup-ico { width: 34px; height: 34px; }
.popup-text { margin: 0; font-weight: bold; color: #7a1a1a; }
.popup-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.popup-win { border-color: #c4161c; }
.popup-win .titlebar { background: linear-gradient(#e85a3a, #c4161c 40%, #a80e14); }
.popblock-bar { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 7000; display: flex; align-items: center; gap: 8px; padding: 5px 10px; background: #fff; border: 1px solid #1b49b8; border-radius: 4px; box-shadow: 2px 3px 8px rgba(0,0,0,.4); }
.pb-ico { width: 20px; height: 20px; }

/* ---------- Mãe, reconexão ---------- */
.mom { padding: 12px 14px; background: #ffe9e9; }
.mom-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.mom-avatar { font-size: 34px; background: #fff; border: 2px solid #d4381a; border-radius: 50%; width: 52px; height: 52px; display: grid; place-items: center; }
.mom-title { display: flex; flex-direction: column; }
.mom-title span { font-size: 11px; color: #555; }
.mom-line { margin: 8px 0 12px; font-weight: bold; color: #8a1a1a; min-height: 3em; }
.mom-btn { width: 100%; }
.mom-btn.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px) rotate(-1deg); } 75% { transform: translateX(5px) rotate(1deg); } }
.window.mom-win { border-color: #d4381a; }
.dial { padding: 12px 14px; background: var(--xp-beige); display: flex; flex-direction: column; gap: 10px; }
.dial-head { display: flex; align-items: center; gap: 10px; }
.dial-ico { width: 36px; height: 36px; }
.dial-label { margin: 0; }

/* ---------- Pegadinha de pastas ---------- */
.fld { padding: 6px; display: flex; flex-direction: column; gap: 6px; height: 100%; }
.fld-path { background: #fff; border: 1px solid #7f9db9; padding: 3px 6px; font-size: 11px; }
.fld-list { flex: 1; background: #fff; border: 1px solid #7f9db9; padding: 8px; }
.fld-item { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid transparent; background: none; font-size: 12px; cursor: pointer; }
.fld-item:hover { background: #316ac5; color: #fff; }
.fld-ico { width: 22px; height: 22px; }
.fld-status { font-size: 11px; color: #555; }
.celta { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: #fffbe0; }
.celta p { margin: 0 0 4px; font-weight: bold; }
.celta-row { display: flex; align-items: center; gap: 8px; }
.celta-row label { width: 90px; }
.celta-row input { flex: 1; }

/* ---------- BonziBuddy ---------- */
.bonzi { position: absolute; right: 24px; bottom: 6px; z-index: 6000; width: 110px; pointer-events: none; }
.bonzi svg { width: 110px; height: 110px; display: block; filter: drop-shadow(2px 3px 2px rgba(0,0,0,.4)); }
.bonzi.arriving { animation: bonzi-in .6s ease-out; }
.bonzi.leaving { animation: bonzi-out .8s ease-in forwards; }
.bonzi-bubble { position: absolute; right: 100px; bottom: 76px; width: 200px; padding: 8px 10px; background: #fffbd0; border: 1px solid #000; border-radius: 10px; font-size: 12px; color: #000; box-shadow: 2px 2px 0 rgba(0,0,0,.25); }
.bonzi-bubble:empty { display: none; }
@keyframes bonzi-in { from { transform: translateX(160px); } to { transform: none; } }
@keyframes bonzi-out { to { transform: translateX(220px) rotate(12deg); opacity: 0; } }

/* ---------- Partículas ---------- */
.float-num { position: fixed; font-weight: bold; font-size: 13px; color: #1f8a1f; text-shadow: 0 0 3px #fff, 0 0 3px #fff; animation: float-up .9s ease-out forwards; transform: translateX(-50%); }
.float-num.dim { color: #888; }
@keyframes float-up { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -48px; } }

/* ---------- Toolbars invasoras ---------- */
.toolbar-stack { flex: none; display: flex; flex-direction: column; }
.tbar { display: flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 12px; background: linear-gradient(#f3f3f3, #d9d9d9); border-bottom: 1px solid #999; animation: tbar-in .3s; }
.tbar-logo { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 4px; border-radius: 3px; color: #fff; font-weight: bold; font-size: 11px; background: var(--tb, #2932e1); }
.tbar-logo.small { height: 26px; min-width: 32px; }
.tbar-name { font-weight: bold; color: #333; min-width: 110px; }
.tbar input { flex: 0 1 220px; min-width: 60px; }
.tbar-btn { padding: 1px 10px; border: 1px solid #666; border-radius: 3px; background: linear-gradient(#fff, #ddd); color: #000; cursor: pointer; }
.tbar-extra { margin-left: auto; color: #555; white-space: nowrap; font-size: 11px; }
@keyframes tbar-in { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- HUD ---------- */
.ie-hud { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 5px 8px; background: linear-gradient(#fdfdf5, #e9e6d2); border-bottom: 1px solid #aca899; }
.hud-chip { display: flex; align-items: center; gap: 6px; padding: 2px 8px; background: #fff; border: 1px solid #b9c0d0; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.hud-chip b { color: #0a3aa8; }
.hud-ico { width: 18px; height: 18px; }
.hud-note { color: #c4161c; font-size: 11px; }
.hud-chip.bonus.on { background: #fff3b0; border-color: #d3a400; color: #6a4a00; font-weight: bold; animation: glow 1.6s ease-in-out infinite; }
.hud-chip.buff { background: #e3ffe3; border-color: #3aa83a; }
.hud-chip.patience { flex: 1 1 200px; min-width: 190px; }
.hud-bar { flex: 1; height: 14px; }
@keyframes glow { 50% { box-shadow: 0 0 6px 1px #ffd23a; } }

/* ---------- Tela azul ---------- */
.bsod { position: fixed; inset: 0; z-index: 30000; background: #0000aa; color: #fff; font-family: "Lucida Console", Consolas, monospace; font-size: 16px; display: flex; align-items: center; justify-content: center; padding: 24px; cursor: none; }
.bsod-inner { max-width: 760px; }
.bsod-inner p { margin: 0 0 18px; }
.bsod-title { text-align: center; }
.bsod-title { display: inline-block; background: #aaaaaa; color: #0000aa; padding: 0 8px; position: relative; left: 50%; transform: translateX(-50%); }
.bsod-foot { text-align: center; }
