/* Estilos Customizados - Portal de Serviços e Cancelamentos */

:root {
  --primary-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  --secondary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: #f4f6f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
}

/* Navbar Customizada */
.navbar-custom {
  background: var(--primary-gradient);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Cards com Sombra Suave */
.card-custom {
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-custom:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

/* Tabela Responsiva Sticky (Mobile-First) */
.table-responsive-sticky {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-sticky th,
.table-sticky td {
  white-space: nowrap;
  vertical-align: middle;
}

/* Coluna Congelada (Sticky Product Column) */
.sticky-col-product {
  position: sticky;
  left: 0;
  background-color: #ffffff !important;
  z-index: 2;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

th.sticky-col-product {
  z-index: 3;
  background-color: #f8f9fa !important;
}

/* Inputs de Cancelamento */
.input-cancellation {
  width: 110px;
  text-align: right;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.input-cancellation:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Indicadores Visuais de Auto-Save */
.save-status-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.3s ease;
}

.save-status-saving {
  background-color: #e2e3e5;
  color: #383d41;
}

.save-status-success {
  background-color: #d1e7dd;
  color: #0f5132;
}

.save-status-error {
  background-color: #f8d7da;
  color: #842029;
}

/* Botões Modernos */
.btn-primary-gradient {
  background: var(--primary-gradient);
  color: white;
  border: none;
}

.btn-primary-gradient:hover {
  background: linear-gradient(135deg, #17305c 0%, #20417a 100%);
  color: white;
}

/* Footer */
footer {
  background-color: #ffffff;
  border-top: 1px solid #e9ecef;
}

/* ==================================================
   NOVOS ESTILOS - TABS E FILTROS (App Feel)
   ================================================== */

.custom-tabs {
  background-color: #ffffff;
  padding: 0.5rem;
  border-radius: 50px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  gap: 0.5rem;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.custom-tabs::-webkit-scrollbar {
  display: none;
}

.custom-tabs .nav-item {
  flex: 1 1 0%; /* Garante que todos tenham EXATAMENTE a mesma largura */
  min-width: 0;
}

.custom-tabs .nav-link {
  color: #495057;
  border-radius: 50px;
  padding: 0.5rem 0.5rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.3s ease;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  text-align: center;
  width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
}

.custom-tabs .nav-link:hover {
  background-color: #f8f9fa;
  color: #0d6efd;
}

.custom-tabs .nav-link.active {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 10px rgba(13, 110, 253, 0.2);
  border-color: transparent;
}

/* Filtros Compactos */
.filter-card {
  background-color: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 1rem;
}

/* ==================================================
   RESPONSIVO E MOBILE-FIRST (Estilo App)
   ================================================== */

@media (max-width: 767.98px) {
  /* Forçar botões principais a ocuparem 100% da tela */
  .btn-mobile-full {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* Ajuste no padding do container principal para mobile */
  .container, .container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Table to Cards */
  .table-mobile-cards thead {
    display: none; /* Esconde os cabeçalhos padrão */
  }
  
  /* Transformando Tabs em App Grid (2x2) no mobile */
  .custom-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 12px;
  }
  
  .custom-tabs .nav-item {
    width: 100%;
  }
  
  .custom-tabs .nav-link {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    text-align: center;
    white-space: normal;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    background-color: #f8fafc; /* Fundo visível para todos */
    border: 1px solid #e2e8f0; /* Borda sutil */
    color: #475569;
  }
  
  .custom-tabs .nav-link.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
  }
  
  .custom-tabs .nav-link i {
    margin-right: 0 !important;
    margin-bottom: 0.25rem;
    font-size: 1.25rem;
  }

  .table-mobile-cards, 
  .table-mobile-cards tbody, 
  .table-mobile-cards tr, 
  .table-mobile-cards td {
    display: block;
    width: 100%;
  }

  .table-mobile-cards tr {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    position: relative;
  }

  .table-mobile-cards td {
    border: none;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
  }

  /* Novo estilo para a célula do Produto virar um Cabeçalho do Card */
  .table-mobile-cards td.td-product-title {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    border-bottom: 2px solid #f1f5f9;
    padding-top: 0;
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
  }
  
  .table-mobile-cards td.td-product-title::before {
    display: none; /* Remove o texto "PRODUTO" repetitivo */
  }

  .table-mobile-cards td.td-product-title .product-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
  }

  .table-mobile-cards td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
    margin-top: 0.25rem;
    justify-content: flex-end; /* Botões de ação alinhados à direita */
  }

  /* Rótulos simulados das colunas (data-label) */
  .table-mobile-cards td::before {
    content: attr(data-label);
    float: left;
    font-weight: 600;
    color: #94a3b8; /* Cor mais suave e limpa */
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    margin-right: 1rem;
    text-align: left;
  }
  
  /* Ajustes específicos para a coluna de Ações / Status */
  .table-mobile-cards td:last-child::before {
    display: none; /* Não mostra label se for óbvio */
  }
  
  /* Remove classe table-hover para não bugar no mobile */
  .table-mobile-cards.table-hover > tbody > tr:hover > * {
    box-shadow: none;
    background-color: #fff;
  }
  
  /* Remove sticky effects do desktop */
  .sticky-col-product {
    position: static;
    box-shadow: none;
  }
}
