/* ======================================================================
   GU THEME — Design System compartilhado
   Cores + tipografia + componentes reutilizáveis
   Import: <link rel="stylesheet" href="gu-theme.css">
   ====================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400&family=Outfit:wght@200;300;400;500;600&family=JetBrains+Mono:wght@300;400;500&display=swap');

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

:root {
  /* Surfaces */
  --bg:        #0e0f13;
  --bg-2:      #16181e;
  --panel:     #12141a;
  --panel-2:   #1a1c24;
  --sunken:    #0a0b0e;

  /* Text */
  --text:      #f0ece4;
  --text-dim:  rgba(240, 236, 228, 0.62);
  --text-mute: rgba(240, 236, 228, 0.38);
  --text-ghost:rgba(240, 236, 228, 0.14);

  /* Brand accent — warm gold */
  --gold:      #c8a97e;
  --gold-hi:   #d8bd93;
  --gold-lo:   rgba(200, 169, 126, 0.10);
  --gold-xlo:  rgba(200, 169, 126, 0.05);
  --gold-glow: rgba(200, 169, 126, 0.06);

  /* Borders */
  --line:        rgba(200, 169, 126, 0.14);
  --line-strong: rgba(200, 169, 126, 0.28);

  /* Semantic */
  --green:  #5dd49f;
  --green-lo: rgba(93, 212, 159, 0.10);
  --green-border: rgba(93, 212, 159, 0.35);
  --red:    #e87878;
  --red-lo: rgba(232, 120, 120, 0.10);
  --red-border: rgba(232, 120, 120, 0.35);
  --amber:  #e9b65a;
  --amber-lo: rgba(233, 182, 90, 0.12);
  --amber-border: rgba(233, 182, 90, 0.35);
  --blue:   #7aa6d1;
  --blue-lo: rgba(122, 166, 209, 0.12);
  --blue-border: rgba(122, 166, 209, 0.35);

  /* Legacy compat (for pages that still reference old vars) */
  --navy:      #12141a;
  --surface:   #12141a;
  --border:    rgba(200, 169, 126, 0.14);
  --text-muted:rgba(240, 236, 228, 0.38);

  /* Type stacks */
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans:  'Outfit', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;
  --font-sans: var(--sans);
  --font-serif: var(--serif);

  /* Motion */
  --ease:      cubic-bezier(.22, 1, .36, 1);
  --ease-snap: cubic-bezier(.34, 1.28, .64, 1);

  /* Radius */
  --radius:    3px;
  --radius-lg: 4px;
  --radius-xl: 6px;

  /* Type scale */
  --fs-display: clamp(2.6rem, 5vw, 5rem);
  --fs-title:   clamp(1.8rem, 3vw, 3.4rem);
  --fs-h2:      clamp(1.4rem, 2.2vw, 2.2rem);
  --fs-h3:      clamp(1.25rem, 1.8vw, 1.85rem);
  --fs-h4:      clamp(1.05rem, 1.4vw, 1.35rem);
  --fs-body:    clamp(.92rem, 1.05vw, 1.1rem);
  --fs-small:   clamp(.72rem, .85vw, .88rem);
  --fs-chrome:  .62rem;
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(ellipse at 15% 20%, rgba(200, 169, 126, 0.06) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 80%, rgba(200, 169, 126, 0.04) 0%, transparent 50%),
    var(--bg);
}

::selection { background: var(--gold); color: var(--bg); }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); }

/* =====================================================================
   TYPOGRAPHY
   ===================================================================== */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 300; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: var(--fs-title); line-height: 1.1; }
h2 { font-size: var(--fs-h2); line-height: 1.15; }
h3 { font-size: var(--fs-h3); line-height: 1.2; }
h4 { font-size: var(--fs-h4); line-height: 1.3; }
p  { font-family: var(--sans); font-weight: 300; line-height: 1.7; color: var(--text-dim); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .7rem;
  font-family: var(--sans); font-weight: 300;
  font-size: var(--fs-chrome); letter-spacing: .28em;
  text-transform: uppercase; color: var(--gold);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: ""; width: 20px; height: 1px; background: var(--gold);
}

/* =====================================================================
   HEADER / NAVBAR
   ===================================================================== */
.gu-header {
  background: rgba(14, 15, 19, 0.85);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  padding: 1rem clamp(1.2rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.gu-brand { display: flex; align-items: center; gap: .9rem; text-decoration: none; }
.gu-brand-mono {
  width: 34px; height: 34px;
  border: 1px solid var(--gold);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 400; font-style: italic;
  font-size: 1.15rem; color: var(--gold);
}
.gu-brand-logo,
.gu-brand img,
img.gu-brand-logo {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  object-fit: contain !important;
  display: block !important;
  flex-shrink: 0 !important;
}
/* Safety net: qualquer img dentro do header/sidebar cai em 40px */
.gu-header img { max-width: 48px !important; max-height: 48px !important; }
.cand-sb img, .sb img { max-width: 40px !important; max-height: 40px !important; }
/* Garantir que img fora de contexto nunca estoure o layout */
img { max-width: 100%; height: auto; }
.gu-brand-lockup { display: flex; flex-direction: column; line-height: 1; gap: .3rem; }
.gu-brand-name {
  font-family: var(--serif); font-weight: 400; font-size: .98rem;
  color: var(--text); letter-spacing: .01em;
}
.gu-brand-sub {
  font-family: var(--sans); font-weight: 300; font-size: .58rem;
  letter-spacing: .3em; text-transform: uppercase; color: var(--gold);
}
.gu-header-back {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--sans); font-weight: 300;
  font-size: var(--fs-chrome); letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-dim);
  transition: color .3s var(--ease);
}
.gu-header-back:hover { color: var(--gold); }

/* =====================================================================
   SIDEBAR
   ===================================================================== */
.gu-sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1.6rem 1rem;
  display: flex; flex-direction: column; gap: 1.2rem;
}
.gu-sidebar-header {
  display: flex; align-items: center; gap: .8rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.gu-sidebar-section-label {
  font-family: var(--sans); font-weight: 300;
  font-size: var(--fs-chrome); letter-spacing: .28em;
  text-transform: uppercase; color: var(--text-mute);
  padding: 0 .8rem; margin-top: .6rem;
}
.gu-sidebar a, .gu-sidebar .gu-nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem .8rem;
  border-radius: var(--radius);
  font-family: var(--sans); font-weight: 300;
  font-size: .85rem; color: var(--text-dim);
  text-decoration: none;
  transition: all .25s var(--ease);
  cursor: pointer;
  border-left: 2px solid transparent;
}
.gu-sidebar a:hover, .gu-sidebar .gu-nav-item:hover {
  color: var(--gold); background: var(--gold-xlo);
}
.gu-sidebar a.active, .gu-sidebar .gu-nav-item.active {
  color: var(--gold); background: var(--gold-lo);
  border-left-color: var(--gold);
}

/* =====================================================================
   CARDS / PANELS
   ===================================================================== */
.gu-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
}
.gu-card-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: .8rem; margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.gu-card-title {
  font-family: var(--serif); font-weight: 400;
  font-size: 1.15rem; color: var(--text);
}
.gu-card-sub {
  font-family: var(--sans); font-weight: 200;
  font-size: .82rem; color: var(--text-dim);
}

/* Stat tiles (dashboard) */
.gu-stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  display: flex; flex-direction: column; gap: .5rem;
  transition: border-color .3s var(--ease);
}
.gu-stat:hover { border-color: var(--line-strong); }
.gu-stat-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--gold-lo);
  border-radius: var(--radius);
  color: var(--gold);
}
.gu-stat-value {
  font-family: var(--serif); font-weight: 300;
  font-size: 2.4rem; line-height: 1; color: var(--text);
  letter-spacing: -.02em;
}
.gu-stat-label {
  font-family: var(--sans); font-weight: 300;
  font-size: var(--fs-chrome); letter-spacing: .22em;
  text-transform: uppercase; color: var(--text-mute);
}

/* =====================================================================
   BUTTONS
   ===================================================================== */
.gu-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .7rem 1.4rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--sans); font-weight: 400;
  font-size: .72rem; letter-spacing: .2em;
  text-transform: uppercase;
  border: 1px solid transparent;
  background: transparent; color: var(--text);
  text-decoration: none;
  transition: all .35s var(--ease);
  white-space: nowrap;
}
.gu-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.gu-btn:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
.gu-btn:disabled, .gu-btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }

.gu-btn-primary {
  background: var(--gold); color: var(--bg); border-color: var(--gold);
}
.gu-btn-primary:hover { background: var(--gold-hi); border-color: var(--gold-hi); }

.gu-btn-outline {
  color: var(--gold); border-color: var(--line-strong);
}
.gu-btn-outline:hover { background: var(--gold-lo); border-color: var(--gold); }

.gu-btn-ghost {
  color: var(--text-dim);
}
.gu-btn-ghost:hover { color: var(--gold); background: var(--gold-xlo); }

.gu-btn-danger {
  color: var(--red); border-color: var(--red-border);
}
.gu-btn-danger:hover { background: var(--red-lo); border-color: var(--red); }

.gu-btn-sm { padding: .48rem 1rem; font-size: .65rem; }
.gu-btn-lg { padding: .95rem 1.8rem; font-size: .78rem; }

/* =====================================================================
   FORMS
   ===================================================================== */
.gu-field { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 1.1rem; }
.gu-label {
  font-family: var(--sans); font-weight: 300;
  font-size: var(--fs-chrome); letter-spacing: .22em;
  text-transform: uppercase; color: var(--text-mute);
}
.gu-input, .gu-textarea, .gu-select {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-family: var(--sans); font-weight: 300;
  font-size: .92rem; color: var(--text);
  transition: border-color .3s var(--ease), background .3s var(--ease);
  outline: none;
}
.gu-input::placeholder, .gu-textarea::placeholder { color: var(--text-mute); font-weight: 200; }
.gu-input:focus, .gu-textarea:focus, .gu-select:focus {
  border-color: var(--gold); background: var(--gold-xlo);
}
.gu-textarea { min-height: 100px; resize: vertical; line-height: 1.6; }

.gu-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c8a97e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.4rem; cursor: pointer;
  color-scheme: dark;
}
.gu-select option {
  background-color: var(--panel-2); color: var(--text);
}

/* =====================================================================
   TABLES
   ===================================================================== */
.gu-table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.gu-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--sans); font-weight: 300; font-size: .88rem;
}
.gu-table thead th {
  text-align: left; padding: .85rem 1.1rem;
  font-family: var(--sans); font-weight: 400;
  font-size: var(--fs-chrome); letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold);
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-2);
}
.gu-table tbody td {
  padding: .85rem 1.1rem;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.gu-table tbody tr { transition: background .25s var(--ease); }
.gu-table tbody tr:hover { background: var(--gold-xlo); }
.gu-table tbody tr:last-child td { border-bottom: none; }

/* =====================================================================
   TABS
   ===================================================================== */
.gu-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.gu-tab {
  position: relative;
  padding: .8rem 1.2rem .8rem 0;
  margin-right: 1.6rem;
  background: transparent; border: none; cursor: pointer;
  font-family: var(--sans); font-weight: 400;
  font-size: var(--fs-chrome); letter-spacing: .2em;
  text-transform: uppercase; color: var(--text-mute);
  transition: color .3s var(--ease);
}
.gu-tab:hover { color: var(--text-dim); }
.gu-tab.active { color: var(--gold); }
.gu-tab.active::after {
  content: ""; position: absolute;
  left: 0; right: 1.6rem; bottom: -1px;
  height: 1px; background: var(--gold);
}

/* =====================================================================
   CHIPS / BADGES
   ===================================================================== */
.gu-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--sans); font-weight: 300;
  font-size: .62rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-dim);
  background: var(--gold-xlo);
}
.gu-chip-accent  { color: var(--gold); border-color: var(--line-strong); }
.gu-chip-success { color: var(--green); border-color: var(--green-border); background: var(--green-lo); }
.gu-chip-warn    { color: var(--amber); border-color: var(--amber-border); background: var(--amber-lo); }
.gu-chip-error   { color: var(--red);   border-color: var(--red-border);   background: var(--red-lo); }
.gu-chip-info    { color: var(--blue);  border-color: var(--blue-border);  background: var(--blue-lo); }

/* =====================================================================
   ALERTS
   ===================================================================== */
.gu-alert {
  padding: .85rem 1rem;
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  border-radius: 2px;
  font-family: var(--sans); font-weight: 300;
  font-size: .88rem; line-height: 1.55;
  margin-bottom: 1rem;
}
.gu-alert-error   { background: var(--red-lo);   color: var(--red);   border-color: var(--red-border); }
.gu-alert-success { background: var(--green-lo); color: var(--green); border-color: var(--green-border); }
.gu-alert-info    { background: var(--blue-lo);  color: var(--blue);  border-color: var(--blue-border); }
.gu-alert-warn    { background: var(--amber-lo); color: var(--amber); border-color: var(--amber-border); }

/* Info-box (editorial) */
.gu-info-box {
  background: var(--gold-xlo);
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.2rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.gu-info-box strong {
  display: block;
  font-family: var(--serif); font-weight: 400;
  font-size: 1.05rem; color: var(--text);
  margin-bottom: .3rem;
}
.gu-info-box span, .gu-info-box p {
  font-family: var(--sans); font-weight: 200;
  font-size: .88rem; line-height: 1.65;
  color: var(--text-dim);
}

/* =====================================================================
   MODAL
   ===================================================================== */
.gu-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(14, 15, 19, 0.82);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  display: none; align-items: center; justify-content: center;
  padding: 1.5rem; z-index: 60;
  animation: gu-fadein .25s var(--ease);
}
.gu-modal-overlay.open { display: flex; }
.gu-modal {
  width: min(100%, 520px);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: clamp(1.6rem, 3vw, 2.2rem);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: gu-slidein .35s var(--ease);
}
.gu-modal-title {
  font-family: var(--serif); font-weight: 300;
  font-size: 1.6rem; line-height: 1.15;
  color: var(--text); margin-bottom: .6rem;
}
.gu-modal-text {
  font-family: var(--sans); font-weight: 200;
  font-size: .95rem; line-height: 1.7;
  color: var(--text-dim); margin-bottom: 1.4rem;
}

/* =====================================================================
   MISC
   ===================================================================== */
.gu-divider { height: 1px; background: var(--line); border: none; margin: 2rem 0; }
.gu-rule    { height: 1px; background: var(--gold); opacity: .55; width: 44px; margin: 1rem 0; }

.gu-skeleton {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel) 50%, var(--panel-2) 75%);
  background-size: 200% 100%;
  animation: gu-shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes gu-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes gu-slidein { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gu-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes gu-su      { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

/* =====================================================================
   RESPONSIVIDADE — Mobile / Tablet
   ===================================================================== */

/* Tablet e menores */
@media (max-width: 900px) {
  .gu-header { padding: .75rem 1rem; gap: .6rem; }
  .gu-brand  { gap: .6rem; min-width: 0; }
  .gu-brand-logo,
  .gu-brand img,
  img.gu-brand-logo,
  .gu-header img { width: 34px !important; height: 34px !important; max-width: 34px !important; max-height: 34px !important; }
  .gu-brand-lockup { min-width: 0; }
  .gu-brand-name { font-size: .9rem; }
  .gu-brand-sub  { font-size: .5rem; letter-spacing: .22em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
  .gu-header-back { font-size: .58rem; letter-spacing: .14em; }
}

/* Mobile de verdade */
@media (max-width: 560px) {
  .gu-header { padding: .65rem .8rem; }
  /* Oculta o subtítulo para dar espaço aos botões */
  .gu-brand-sub { display: none; }
  .gu-brand-name { font-size: .85rem; letter-spacing: .005em; }
  /* Botões do header ficam menores e sem estourar */
  .gu-header .gu-btn,
  .gu-header .gu-btn-outline,
  .gu-header .gu-btn-primary {
    padding: .5rem .7rem;
    font-size: .62rem;
    letter-spacing: .1em;
  }
  .gu-header-back { font-size: .55rem; }
  /* Grids padrão colapsam pra 1 coluna */
  .grid,
  .gu-grid,
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
    gap: .8rem;
  }
  /* Cards com padding mais econômico */
  .card, .info-card, .channel-card {
    padding: 1.1rem 1rem;
  }
  /* Modais nunca estouram a viewport */
  .modal, .modal-overlay > .modal {
    width: calc(100vw - 1.5rem) !important;
    max-width: calc(100vw - 1.5rem) !important;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 1.1rem;
  }
  /* Botões de largura fluida (linha única no mobile) */
  .modal-actions {
    flex-wrap: wrap;
  }
  .modal-actions .gu-btn { flex: 1 1 auto; }
  /* Tabelas: sempre com scroll horizontal contido */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Inputs não estouram width */
  .gu-input, .gu-select, .gu-textarea { width: 100%; max-width: 100%; }
}

