/* Gantari — mesmos pesos que app.py (subset) */
@font-face {
  font-family: "Gantari";
  src: url("/fonts/Gantari/Gantari-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gantari";
  src: url("/fonts/Gantari/Gantari-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Gantari";
  src: url("/fonts/Gantari/Gantari-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gantari";
  src: url("/fonts/Gantari/Gantari-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gantari";
  src: url("/fonts/Gantari/Gantari-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --cast-font: "Gantari", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--cast-font);
  color: #1a1a1a;
  background: #f5f5f7;
}

/* Layout: barra superior + corpo (sidebar | conteúdo) */
.app-body {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 81px);
  padding-bottom: 48px;
}

.app-sidebar {
  flex: 0 0 min(300px, 92vw);
  max-width: 320px;
  background: linear-gradient(180deg, #ebe9f5 0%, #e4e1f0 100%);
  border-right: 1px solid #d8d4e8;
  padding: 20px 18px 28px;
  overflow-y: auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-head__icon {
  display: flex;
  color: var(--cast-cor-primaria);
}

.sidebar-head__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #2d2a3d;
  letter-spacing: -0.02em;
}

.sidebar-section {
  margin-bottom: 22px;
}

.sidebar-section__title {
  margin: 0 0 12px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b6580;
}

.sidebar-field {
  margin-bottom: 14px;
}

.sidebar-field__label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: #555;
  margin-bottom: 6px;
}

.sidebar-field__row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #dcd8ea;
  border-radius: 8px;
  padding: 8px 10px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.sidebar-field__value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
}

.sidebar-field__mono {
  background: #fff;
  border: 1px solid #dcd8ea;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #222;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav__btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-family: var(--cast-font);
  font-size: 0.9rem;
  font-weight: 500;
  color: #4a4560;
  line-height: 1.35;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.sidebar-nav__btn:hover {
  background: #fff;
  border-color: #d0cbe0;
  color: var(--cast-cor-primaria);
}

.sidebar-nav__btn:focus-visible {
  outline: 2px solid var(--cast-cor-primaria);
  outline-offset: 2px;
}

.sidebar-nav__btn.is-active {
  background: #fff;
  border-color: var(--cast-cor-primaria);
  color: var(--cast-cor-primaria);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(126, 48, 163, 0.12);
}

.sidebar-nav__ico {
  flex-shrink: 0;
  display: flex;
  color: currentColor;
  margin-top: 1px;
}

.sidebar-nav__text {
  flex: 1;
}

.app-content {
  flex: 1;
  min-width: 0;
  background: #fff;
}

.cast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: #ffffff;
  padding: 14px 32px;
  border-bottom: 1px solid #e5e5e5;
}

.cast-header img {
  max-height: 52px;
  width: auto;
  object-fit: contain;
}

.cast-main {
  max-width: none;
  margin: 0;
  padding: 28px 20px 88px;
}

/* Coluna central (~720px), alinhada ao mock */
.page-column {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.cast-title {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3.2vw, 2rem);
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
}

.cast-intro {
  margin: 0 0 20px;
  color: #555;
  line-height: 1.55;
  font-size: 0.98rem;
}

.subhead {
  margin: 0 0 14px;
  font-size: 1.12rem;
  font-weight: 700;
  color: #222;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.95rem;
}

.text-input {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: var(--cast-font);
  font-size: 1rem;
  margin-bottom: 20px;
}

.text-input:focus {
  outline: 2px solid var(--cast-cor-primaria);
  outline-offset: 1px;
}

/* Abas (equivalente Streamlit) */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 22px;
}

.tab-btn {
  font-family: var(--cast-font);
  padding: 12px 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #555;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--cast-cor-primaria);
}

.tab-btn.is-active {
  color: var(--cast-cor-primaria);
  border-bottom-color: var(--cast-cor-primaria);
  font-weight: 600;
}

.tab-panel.is-hidden {
  display: none !important;
}

/* Conteúdo das abas: mesma largura da coluna */
.panel-stack {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  width: 100%;
}

.panel-stack .webrtc-wrap {
  margin-left: 0;
  margin-right: 0;
  max-width: none;
}

.panel-stack .msg {
  margin-left: 0;
  margin-right: 0;
  max-width: none;
}

.webrtc-wrap {
  margin: 0 0 18px;
}

/* Área do vídeo: cinza claro como placeholder; escurece com stream */
.video-shell {
  border-radius: 12px;
  overflow: hidden;
  background: #f0f0f0;
  min-height: min(42vh, 380px);
  max-height: min(58vh, 520px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid #e8e8e8;
}

.video-shell.has-stream {
  background: #111;
  border-color: #333;
}

.cast-video {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(58vh, 520px);
  object-fit: contain;
  margin: 0;
}

/* Controlo discreto abaixo do vídeo, à esquerda (como START no mock) */
.webrtc-controls {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding-top: 10px;
  gap: 8px;
}

.btn-cam-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  color: #6b6b6b;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.btn-cam-toggle:hover {
  border-color: var(--cast-cor-primaria);
  color: var(--cast-cor-primaria);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-cam-toggle:focus-visible {
  outline: 2px solid var(--cast-cor-primaria);
  outline-offset: 2px;
}

.btn-cam-toggle.is-active {
  border-color: var(--cast-cor-primaria);
  color: var(--cast-cor-primaria);
  background: #faf7fc;
}

.btn-cam-toggle__icons {
  display: grid;
  place-items: center;
}

.btn-cam-toggle__icons svg {
  grid-area: 1 / 1;
}

.btn-cam-toggle__icons .icon-cam-on[hidden],
.btn-cam-toggle__icons .icon-cam-off[hidden] {
  display: none !important;
}

.btn {
  font-family: var(--cast-font);
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid #ccc;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--cast-cor-primaria);
  border-color: var(--cast-cor-primaria);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--cast-cor-secundaria);
  border-color: var(--cast-cor-secundaria);
  color: #fff;
}

.btn-secondary {
  background: #f5f5f5;
  color: #222;
}

.btn-secondary:hover:not(:disabled) {
  background: #eaeaea;
}

.btn-block {
  width: 100%;
  max-width: 100%;
  margin: 0;
  display: block;
  border-radius: 10px;
  padding: 12px 20px;
  font-weight: 600;
}

.msg {
  margin-top: 14px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}

.msg.info {
  color: #0a5;
}
.msg.warn {
  color: #a60;
}
.msg.err {
  color: #c22;
}
.msg.success {
  color: #070;
}

.metric-row {
  margin-top: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cast-cor-primaria);
}

.caption {
  font-size: 0.85rem;
  color: #666;
  margin-top: 6px;
}

.spinner-hint {
  margin-top: 8px;
  color: #444;
}

.cast-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--cast-cor-secundaria);
  color: #ffffff;
  padding: 10px 24px;
  font-size: 0.85rem;
  z-index: 999;
  font-family: var(--cast-font);
}

@media (max-width: 768px) {
  .app-body {
    flex-direction: column;
    min-height: auto;
  }

  .app-sidebar {
    flex: none;
    max-width: none;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #d8d4e8;
    padding: 16px 16px 18px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .sidebar-nav__btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 140px;
  }
}
