/*
 * Plataforma 4i visual system.  The markup keeps the add-in's existing
 * JavaScript IDs while using the same tokens and component values as the
 * approved design preview.
 */
:root {
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --colors-primary-regular: #4C94FF;
  --colors-primary-hover: #366DBE;
  --colors-primary-active: #224880;
  --colors-primary-000: #DBEBFF;
  --colors-primary-100: #B8D6FF;
  --colors-primary-200: #95C1FF;
  --colors-primary-300: #71ABFF;
  --colors-secondary-regular: #F27DB4;
  --colors-tertiary-regular: #48BB78;
  --colors-tertiary-subtle: #DEF7EC;
  --colors-neutral-white: #FFFFFF;
  --colors-neutral-000: #F7FAFC;
  --colors-neutral-100: #EDF2F7;
  --colors-neutral-200: #E2E8F0;
  --colors-neutral-300: #CBD5E0;
  --colors-neutral-400: #A0AEC0;
  --colors-neutral-500: #718096;
  --colors-neutral-600: #4A5568;
  --colors-neutral-700: #2D3748;
  --colors-neutral-800: #1A202C;
  --surface-canvas: #F7FAFC;
  --surface-card: #FFFFFF;
  --surface-sunken: #EDF2F7;
  --border-default: #E2E8F0;
  --border-active: #4C94FF;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-pill: 9999px;
  --shadow-float: 0 0 16px 4px rgba(113, 128, 150, 0.4);
  /* Compatibility aliases used by the existing utility markup. */
  --primary-regular: var(--colors-primary-regular);
  --primary-subtle: var(--colors-primary-000);
  --neutral-000: var(--colors-neutral-000);
  --neutral-100: var(--colors-neutral-100);
  --neutral-200: var(--colors-neutral-200);
  --neutral-400: var(--colors-neutral-400);
  --neutral-500: var(--colors-neutral-500);
  --neutral-600: var(--colors-neutral-600);
  --neutral-700: var(--colors-neutral-700);
  --neutral-800: var(--colors-neutral-800);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--surface-canvas);
  color: var(--colors-neutral-700);
  font-family: var(--font-family-base);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }

#sideload-msg {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--colors-neutral-500);
}
#app-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100%;
  padding: 16px;
  gap: 14px;
  background: var(--surface-canvas);
  overflow: hidden;
  overflow-x: hidden;
}
.tabs-scroll-area {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
}
.footer-links { flex-shrink: 0; }

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 12px 14px;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--border-default);
}
.top-header > div:first-child { display: flex; align-items: center; gap: 10px; }
.brand-logo-link { display: inline-flex; align-items: center; gap: 8px; color: var(--colors-neutral-800); text-decoration: none; }
.brand-logo-link:hover, .brand-logo-link:focus-visible { opacity: .8; }
.brand-logo-link strong { font-size: 15px; font-weight: 700; white-space: nowrap; }
.top-header img { width: 28px !important; height: 28px !important; border-radius: var(--radius-sm); }
.top-header img + span { font-size: 11px; font-weight: 600; color: var(--colors-primary-regular); background: var(--colors-primary-000); padding: 2px 8px; border-radius: var(--radius-pill); text-transform: uppercase; letter-spacing: .04em; }
.top-header > span { font-size: 11px; color: var(--colors-neutral-400); font-weight: 500; }

.main-tab-bar {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  padding: 3px;
  background: var(--colors-neutral-100);
  border-radius: var(--radius-md);
}
.main-tab-btn, .subtab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  padding: 7px 4px;
  color: var(--colors-neutral-500);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s ease;
  font-size: 12px;
  font-weight: 500;
}
.main-tab-btn:hover, .subtab-btn:hover { color: var(--colors-neutral-700); }
.main-tab-btn.active, .subtab-btn.active {
  color: var(--colors-primary-regular);
  background: var(--surface-card);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.tab-pane { display: flex; flex-direction: column; gap: 12px; }
.tab-pane:not(.active) { display: none !important; }
.card {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--border-default);
  padding: 14px;
}
.card { display: flex; flex-direction: column; gap: 12px; }
.auth-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
#auth-status {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-width: 0;
}
#auth-status-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--colors-neutral-600);
}
.auth-card > button { flex: 0 0 auto; }
.auth-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--colors-neutral-400); display: inline-block; margin-right: 8px; }
.auth-dot.active { background: var(--colors-tertiary-regular); box-shadow: 0 0 0 3px var(--colors-tertiary-subtle); }

.card h3 { font-size: 14px; font-weight: 600; color: var(--colors-neutral-800); display: flex; align-items: center; gap: 6px; }
.card h3 + div { color: var(--colors-neutral-600); }
.frequent-indicators-card { gap: 8px; }
.frequent-indicators-subtitle {
  margin: -2px 0 2px;
  color: var(--colors-neutral-500);
  font-size: 11.5px;
}
.frequent-indicators-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.frequent-indicator-chip {
  padding: 5px 10px;
  color: var(--colors-neutral-600);
  background: var(--colors-neutral-100);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: background-color .15s ease, color .15s ease;
}
.frequent-indicator-chip:hover,
.frequent-indicator-chip:focus-visible {
  color: var(--colors-primary-active);
  background: var(--colors-primary-000);
  outline: none;
}
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  color: var(--colors-neutral-600);
  background: var(--colors-neutral-100);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}
.lang-toggle:hover, .lang-toggle:focus-visible {
  color: var(--colors-primary-active);
  background: var(--colors-primary-000);
  outline: none;
}
.btn-primary, .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color .15s ease, transform .05s ease, box-shadow .15s ease;
}
.btn-primary { width: 100%; color: var(--colors-neutral-white); background: var(--colors-primary-regular); border: 0; }
.btn-primary:hover { background: var(--colors-primary-hover); }
.btn-primary:active { background: var(--colors-primary-active); transform: translateY(1px); }
.btn-outline { color: var(--colors-neutral-700); background: var(--surface-card); border: 0; box-shadow: inset 0 0 0 1px var(--border-default); }
.btn-outline:hover { background: var(--colors-neutral-100); }

input[type="text"], select {
  width: 100%;
  padding: 7px 10px;
  color: var(--colors-neutral-700);
  background: var(--surface-card);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--border-default);
  outline: 0;
  transition: box-shadow .15s ease;
}
input[type="text"]:focus, select:focus { box-shadow: inset 0 0 0 2px var(--colors-primary-regular); }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; cursor: pointer; background: var(--colors-neutral-300); border-radius: 20px; transition: .2s ease; }
.slider:before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; bottom: 3px; background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: .2s ease; }
.switch input:checked + .slider { background: var(--colors-primary-regular); }
.switch input:checked + .slider:before { transform: translateX(16px); }

.subtab-btn { padding: 6px 4px; }
.subpane-content.hidden { display: none; }
.subpane-content:not(.hidden) { display: flex; }
#preview-text {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 10px;
  color: var(--colors-primary-active);
  background: var(--colors-neutral-000);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--colors-neutral-200);
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  word-break: break-all;
  user-select: all;
}

.loading-spinner { display: none; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 10px; background: var(--colors-primary-000); border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--colors-primary-200); }
.loading-container { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.loading-content { width: 32px; height: 32px; padding: 8px; background: var(--colors-primary-regular); border-radius: 5%; box-sizing: content-box; }
.loading-bar-contents { display: flex; flex-direction: row; justify-content: space-between; width: 100%; height: 100%; }
.loading-bar-contents > div { background: white; width: 20%; border-radius: 15%; }
.loading-bar-contents > div:nth-child(1) { height: 60%; animation: upAnimation .7s ease infinite; }
.loading-bar-contents > div:nth-child(2) { height: 100%; }
.loading-bar-contents > div:nth-child(3) { margin-top: 45%; height: 60%; animation: downAnimation .7s ease infinite; }
@keyframes upAnimation { 0%, 100% { transform: translate3d(0, 70%, 0); } 50% { transform: translate3d(0, 0, 0); } }
@keyframes downAnimation { 0%, 100% { transform: translate3d(0, -70%, 0); } 50% { transform: translate3d(0, 0, 0); } }
.loading-message { font-size: 12px; font-weight: 600; color: var(--colors-primary-active); text-align: center; }
.option-row, .flex.items-center.justify-between.p-2 { cursor: pointer; transition: background-color .15s ease; }
.option-row:hover { background: var(--colors-neutral-100); }

#toast, .toast-notice {
  position: fixed; left: 50%; bottom: 20px; z-index: 9999;
  transform: translateX(-50%) translateY(100px);
  padding: 8px 16px; color: white; background: var(--colors-neutral-800);
  border-radius: var(--radius-pill); box-shadow: var(--shadow-float);
  font-size: 12px; font-weight: 500; opacity: 0; pointer-events: none;
  transition: all .25s cubic-bezier(.16,1,.3,1);
}
#toast.show, .toast-notice.show { transform: translateX(-50%) translateY(0); opacity: 1; }

@media (max-width: 360px) {
  #app-body { padding: 10px; gap: 10px; }
  .card { padding: 12px; }
}
