/* =========================================================
   ASSETS/CSS/PAGES.CSS
   Layouts específicos: Home, Lista de Cotas, Barra de Seleção
========================================================= */

/* =========================================================
   1. USER STRIP (Barra do Vendedor/Parceiro)
========================================================= */
.user-strip {
  position: sticky;
  top: 95px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 12px 12px auto;
  width: min(360px, calc(100vw - 24px));
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--brand-secondary);
  font-weight: 600;
  transition: box-shadow .16s ease, border-color .16s ease;
}

.user-strip.is-floating {
  box-shadow: 0 8px 18px rgba(10,42,84,.10);
  border-color: rgba(10,42,84,.08);
}

.user-strip::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary, #22B2D6), var(--brand-primary, #2279D6));
  box-shadow: 0 0 0 4px rgba(34,178,214,.12);
  margin-left: 6px;
  animation: userStatusPulse 2.4s ease-in-out infinite;
}

@keyframes userStatusPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.9; }
}

.user-strip__role {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border, #DBE6F0);
  background: var(--surface-3);
  color: var(--brand-secondary, #334155);
  font-size: 12px;
}

.user-strip__logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface, #FFFFFF);
  color: var(--brand-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: all .12s ease;
}
.user-strip__logout:hover { border-color: var(--brand-primary, #2279D6); box-shadow: 0 2px 10px rgba(34,121,214,.12); }


/* =========================================================
   2. LAYOUT: PÁGINA COTAS (Wrapper & Header)
========================================================= */
.cotas {
  min-height: calc(100vh - 120px);
  padding: 56px 16px 0;
  background: var(--bg);
}

.cotas-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  border-radius: 16px;
}

.cotas-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.cotas-title {
  margin: 0;
  color: var(--brand-secondary);
  font-size: 2rem;
  font-weight: 700;
}

.cotas-actions-top { display: flex; gap: 12px; }


/* =========================================================
   3. TOOLBAR & FILTROS
========================================================= */
.cotas-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.cotas-toolbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cotas-filter-btn{
  /* base do botão (estilo mesmo) */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;

  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fff);
  color: var(--brand-secondary, #0f172a);

  cursor: pointer;
  font-size: 14px;
  font-weight: 500;

  box-shadow: var(--shadow-btn, 0 1px 2px rgba(16,24,40,.06));

  /* estabilidade visual */
  box-sizing: border-box;
  line-height: 1;
  white-space: nowrap;

  /* evita estilos default/resets esquisitos */
  -webkit-appearance: none;
  appearance: none;
}

.cotas-filter-btn:hover { border-color: var(--brand-primary, #22B2D6); }
.cotas-filter-btn:active { transform: translateY(1px); }

.cotas-filter-btn:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--brand-primary, #22B2D6) 35%, transparent);
  outline-offset: 2px;
}

/* Ícone (caixinha) */
.cotas-filter-btn__icon{
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
}

/* SVG “domado” (inclui caso venha com style inline) */
.cotas-filter-btn__icon svg{
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Texto */
.cotas-filter-btn > span{
  line-height: 1;
}

/* bolinha do indicador */
.cotas-filter-indicator{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-primary, #22B2D6);
  display: inline-block;
  flex: 0 0 8px;
  margin-left: 2px;
}

.cotas-filter-indicator { width: 8px; height: 8px; border-radius: 999px; background: var(--brand-action, #0FAF9D); }
.cotas-active-filters { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--brand-secondary, #4A5A70); }

.cotas-segmentos { display: inline-flex; flex-wrap: wrap; gap: 10px; }
.segmento-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand-secondary);
  text-decoration: none;
  transition: all .15s ease;
}
.segmento-link.is-active { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--surface, #fff); }

.cotas-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.cotas-view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.cotas-view-toggle-btn.is-active { background: var(--surface-3); color: var(--brand-secondary); }

/* Barra de Resultados e Lista */
.cotas-results-bar {
  margin: 12px 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2, #F7FAFC);
  border: 1px solid var(--border, #E1E8F0);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.cotas-results-main { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--brand-secondary, #334155); }
.cotas-results-main strong { font-size: 18px; color: var(--brand-primary, #2279D6); }

.cotas-lista { 
  display: flex; 
  flex-direction: column; 
  gap: 14px; 
  margin-bottom: 0; 
}

/* =========================================================
   DISCLAIMER / AVISO LEGAL
========================================================= */

.cotas-disclaimer-box {
    margin-top: 40px; /* Distância segura da paginação */
    margin-bottom: 20px;
    padding: 24px;
    background-color: var(--cl-table-head-bg, #f8fafc); /* Fundo suave */
    border: 1px solid var(--cl-table-border, #e2e8f0);
    border-radius: 8px;
    text-align: center; /* Centralizado fica mais elegante no rodapé */
}

.cotas-disclaimer-text {
    margin: 0 0 8px 0;
    line-height: 1.5;
    color: var(--cl-text-muted, #64748b); /* Cinza médio para não cansar a vista */
}

.cotas-disclaimer-text:last-child {
    margin-bottom: 0;
}

.cotas-disclaimer-text small {
    font-size: 0.75rem; /* 12px */
    display: block;
}

.cotas-disclaimer-text strong {
    color: var(--cl-text-main, #334155); /* Negritos levemente mais escuros */
    font-weight: 600;
}

/* Ajuste Mobile */
@media (max-width: 768px) {
    .cotas-disclaimer-box {
        margin-top: 25px;
        padding: 15px;
        border-radius: 6px;
    }
    
    .cotas-disclaimer-text small {
        font-size: 0.7rem; /* Um pouco menor no mobile */
        text-align: justify; /* Melhora a leitura de blocos de texto no celular */
        text-align-last: center; /* A última linha fica centralizada */
    }
}

/* =========================================================
   4. LAYOUT: HOME
========================================================= */
.cotas-home {
  min-height: calc(100vh - 120px);
  padding: 80px 16px 120px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--surface);
}
.cotas-home-container { max-width: 960px; width: 100%; text-align: center; }
.cotas-home-title { margin-bottom: 8px; color: var(--brand-secondary); font-size: 2.4rem; font-weight: 700; }
.cotas-home-subtitle { margin-bottom: 48px; color: var(--muted, #7A869A); font-size: 1rem; }
.cotas-home-grid { display: flex; flex-wrap: wrap; gap: 36px; justify-content: center; }
.cotas-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 320px; max-width: 100%; min-height: 220px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  cursor: pointer; text-decoration: none;
  transition: transform .15s ease, border-color .15s ease;
}
.cotas-card:hover { transform: translateY(-4px); border-color: var(--brand-primary); box-shadow: 0 8px 24px rgba(0,0,0,.06); }
.cotas-card-icon svg { width: 64px; height: 64px; margin-bottom: 20px; }
a.cotas-card .cotas-card-label {
  color: var(--brand-secondary); font-size: 1.25rem; font-weight: 600;
}

/* =========================================================
   5. BARRA DE SELEÇÃO (Fixed Bottom - Estável)
========================================================= */
.cota-selection-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border, #dbe6f0);
  box-shadow: 0 -4px 24px rgba(10,42,84,0.15);
  padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
  
  transition: transform 0.3s ease;
}

.cota-selection-bar[hidden] { display: none !important; }

.cota-selection-bar .cs-inner {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  
  display: grid;
  /* 4 Colunas: Seleção | Grupo (Central) | Totais (Direita) | Ações */
  grid-template-columns: 1fr auto 1fr auto;
  gap: 20px;
  align-items: center;
}

/* Col 1: Seleção */
.cs-col--sel {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
}
.cs-title-row { display: flex; align-items: center; gap: 10px; }
.cota-selection-title { color: var(--brand-secondary); font-size: 1rem; white-space: nowrap; }
.cs-badge {
  padding: 2px 10px;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--border, #DBE6F0);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-secondary);
  white-space: nowrap;
}

/* Col 2: Grupo (Chips) */
.cs-col--group {
  grid-column: 2;
  display: flex;
  justify-content: center;
}
.cs-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface, #fff);
  white-space: nowrap;
}
.cs-group-item { display: flex; align-items: center; gap: 8px; }
.cs-chip-seg { display: flex; align-items: center; gap: 8px; }
.cs-seg-icon svg { width: 18px; height: 18px; display: block; fill: currentColor; }
.cs-seg-icon { display: none; color: var(--muted); }
.cs-seg-icon--imovel { color: var(--brand-action, #0FAF9D); }
.cs-seg-icon--veiculo { color: var(--brand-primary, #2279D6); }
.cs-seg-icon.is-active { display: block; }
.cs-chip-value { font-weight: 700; color: var(--brand-secondary, #0F172A); font-size: 0.95rem; }
.cota-pill-dot { width: 4px; height: 4px; background: var(--border, #cbd5e1); border-radius: 50%; display: inline-block; margin: 0 4px; }

/* Col 3: Totais */
.cs-col--totais {
  grid-column: 3;
  display: flex;
  justify-content: flex-end;
}
.cs-kpis { display: flex; gap: 24px; text-align: right; }
.cs-kpi { display: flex; flex-direction: column; }
.cs-kpi-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.cs-kpi-value { font-size: 1.2rem; font-weight: 800; color: var(--brand-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Col 4: Ações */
.cs-col--acoes {
  grid-column: 4;
  display: flex;
  justify-content: flex-end;
}
.cota-selection-actions { display: flex; align-items: center; gap: 12px; }

/* Alerta de Erro */
.cota-selection-alert {
  position: absolute;
  bottom: 100%;
  left: 20px;
  margin-bottom: 12px;
  background: var(--danger, #FEF2F2);
  border: 1px solid var(--danger, #FECACA);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  max-width: 350px;
  z-index: 10;
}
.cota-selection-alert[hidden] { display: none; }


/* =========================================================
   6. RESPONSIVO GLOBAL
========================================================= */

/* Tablet (1024px): Remove a coluna central (Grupo) para dar espaço */
@media (max-width: 1024px) {
  .cota-selection-bar .cs-inner {
    grid-template-columns: 1fr 1fr auto; 
  }
  .cs-col--sel    { grid-column: 1; }
  .cs-col--group  { display: none; }
  .cs-col--totais { grid-column: 2; }
  .cs-col--acoes  { grid-column: 3; }
}

/* Mobile (768px): Reorganização total */
@media (max-width: 768px) {
  .cotas { padding: 40px 12px 72px; }
  .cotas-container { padding: 22px 16px; }
  .cotas-header { align-items: flex-start; }
  .cotas-toolbar { flex-direction: row; display: flex; flex-wrap: wrap; justify-content: center; }
  .cotas-segmentos { width: 100%; justify-content: center; margin-top: 10px; }
  .cotas-results-bar { flex-direction: column; align-items: flex-start; }
  .cotas-home-title { font-size: 2rem; }

  .user-strip { gap: 8px; font-size: 14px; }
  .user-strip__role { display: none; }

  .cota-selection-bar {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }

  .cota-selection-bar .cs-inner {
    display: grid;
    grid-template-columns: 1fr auto; 
    grid-template-rows: auto auto;
    gap: 12px;
  }

  /* Posicionamento no Grid 2x2 */
  .cs-col--sel {
    grid-column: 1; 
    grid-row: 1;
    align-items: flex-start;
  }

  .cs-col--group { display: none; }

  .cs-col--acoes {
    grid-column: 2;
    grid-row: 1;
  }
  
  .cs-col--totais {
    grid-column: 1 / span 2;
    grid-row: 2;
    background: var(--surface-2, #F8FAFC);
    border-radius: 8px;
    padding: 8px 12px;
    justify-content: space-between;
    width: 100%;
  }

  /* Ajustes Mobile nos Elementos */
  .cs-kpis { width: 100%; justify-content: space-between; gap: 0; }
  .cs-kpi { align-items: flex-start; }
  .cs-kpi-value { font-size: 1rem; }
  
  .cota-selection-alert {
    left: 10px; right: 10px; max-width: none;
  }
  
  .cota-selection-actions .btn-sm { padding: 8px 12px; }
}

/* =========================================================
   PÁGINA 404 (Erro)
========================================================= */

.pc-404-container {
    text-align: center;
    padding: 80px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pc-404-title {
    font-size: 8rem;
    font-weight: 900;
    line-height: 1;
    color: var(--surface-3, #EFF6FB);
    margin: 0;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 0 var(--border, #d6e5ec);
}

.pc-404-subtitle {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-secondary, #0A2A54);
    margin: -20px 0 20px 0;
    position: relative;
    z-index: 2;
}

.pc-404-description {
    font-size: 1.1rem;
    color: var(--muted, #64748B);
    max-width: 500px;
    margin: 0 auto 40px auto;
    line-height: 1.6;
}

.pc-404-actions .btn {
    padding: 12px 30px;
    font-size: 1rem;
    border-radius: 99px;
    box-shadow: 0 4px 15px rgba(34, 178, 214, 0.3);
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    .pc-404-container {
        padding: 60px 20px;
    }

    .pc-404-title {
        font-size: 5rem;
    }

    .pc-404-subtitle {
        font-size: 1.5rem;
        margin-top: -10px;
    }

    .pc-404-description {
        font-size: 1rem;
        margin-bottom: 30px;
    }
}