/* ===========================================
   NETCOM Internet - Painel Administrativo
   Tema corporativo moderno e responsivo
   =========================================== */

/* --- Variáveis de cor (defaults = tema Laranja; sobrescritas por theme_vars.php) --- */
:root {
  --color-primary:            #ff7a00;
  --color-primary-dark:       #ff3c00;
  --color-accent:             #ffb300;
  --color-card-border:        #ffe8d6;
  --color-card-accent:        #ffcc99;
  --color-card-header-bg:     #fff3ec;
  --color-card-header-border: #ffb380;
  --color-card-header-text:   #cc5500;

  /* aliases legados */
  --netcom-orange: var(--color-primary);
  --netcom-red:    var(--color-primary-dark);
  --netcom-gold:   var(--color-accent);

  --page-bg: #f5f6fa;
  --shadow: 0 3px 10px rgba(0,0,0,0.08);
}

html {
  overflow-x: hidden;
}

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

/* --- Estilo global --- */
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--page-bg);
  color: #333;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255,122,0,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,122,0,.035) 1px, transparent 1px),
    radial-gradient(circle at 100% 0, rgba(255,122,0,.13) 0 170px, rgba(255,179,0,.08) 171px 235px, transparent 236px),
    radial-gradient(circle at 0 100%, transparent 0 166px, rgba(255,60,0,.10) 167px 169px, transparent 170px 245px, rgba(255,122,0,.045) 246px 300px, transparent 301px),
    radial-gradient(circle at 12% 18%, rgba(255,179,0,.20), transparent 31rem),
    radial-gradient(circle at 88% 84%, rgba(255,60,0,.13), transparent 34rem),
    linear-gradient(135deg, #fffaf6 0%, #f5f6fa 52%, #fff3ec 100%);
  background-attachment: fixed;
  background-repeat: repeat, repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-size: 44px 44px, 44px 44px, cover, cover, cover, cover, cover;
}

h1,h2,h3,h4,h5 {
  font-weight: 600;
}

a { text-decoration: none; }

.kv-muted { color: #888; }

/* --- Container principal --- */
.container-main {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: visible;
}




/* --- Botões --- */
.btn-netcom {
  background: linear-gradient(90deg, var(--netcom-orange), var(--netcom-red));
  color: #fff !important;
  font-weight: 500;
  border: none;
  transition: 0.2s;
}
.btn-netcom:hover { opacity: 0.9; }

.btn-outline-netcom {
  border: 1px solid var(--netcom-orange);
  color: var(--netcom-orange) !important;
  background: transparent;
  font-weight: 500;
}
.btn-outline-netcom:hover {
  background: linear-gradient(90deg, var(--netcom-orange), var(--netcom-red));
  color: #fff !important;
}

/* --- Cards e tabelas --- */
.card {
  background: #fff;
  border: none;
  box-shadow: var(--shadow);
  border-radius: 10px;
}

.table {
  width: 100%;
  table-layout: fixed; /* 👈 força a tabela a respeitar o container */
  min-width: 0;
}



.table th {
  background: #f3f4f6;
  font-weight: 600;
  color: #444;
  white-space: normal;
  word-break: break-word;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.table th small {
  font-weight: 500;
}
.table td {
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* --- Formulários --- */
.form-control, .form-select, textarea {
  border-radius: 6px;
  box-shadow: none !important;
}
label.form-label { font-weight: 500; }

.input-search {
  border-radius: 20px;
  padding-left: 15px;
  border: 1px solid #ddd;
}

/* ===========================================
   SIDEBAR LAYOUT - Novo Gradiente NETCOM
   =========================================== */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--netcom-orange), var(--netcom-red));
  color: #fff;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  padding-top: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  z-index: 1000;
}

.sidebar-header {
  text-align: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.sidebar-header img {
  height: 110px;
  margin-bottom: 2px;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.55) rgba(0,0,0,.12);
}

.sidebar-menu::-webkit-scrollbar {
  width: 8px;
}

.sidebar-menu::-webkit-scrollbar-track {
  background: rgba(0,0,0,.12);
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.45);
  border-radius: 999px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.65);
}
.sidebar-menu li a {
  display: block;
  padding: 10px 20px;
  color: #fff;
  font-weight: 500;
  transition: background 0.2s;
}
.sidebar-menu li a:hover {
  background: rgba(255,255,255,0.15);
}
.sidebar-menu li.active a {
  background: rgba(0,0,0,0.25);
  font-weight: 600;
}

/* --- Header superior --- */
.topbar-main {
  background: linear-gradient(90deg, var(--netcom-orange), var(--netcom-red));
  color: #fff;
  padding: 14px 24px;
  position: fixed;
  top: 0;
  left: 240px;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  z-index: 999;
  display: none !important;
}
.topbar-main h5 { margin: 0; font-weight: 500; }

main.with-sidebar {
  margin-left: 240px;
  width: calc(100% - 240px);
  padding-top: 28px; /* base */
  padding-bottom: 40px;
  min-height: 100vh;
  box-sizing: border-box;
}

@media (max-height: 800px) {
  main.with-sidebar {
    padding-top: 20px; /* telas baixas (notebooks comuns) */
  }
}




/* ===========================================
   ANIMAÇÕES DE ENTRADA
   =========================================== */
.fade-in-up {
  opacity: 0;
  transform: translateY(15px);
  animation: fadeUp 0.7s ease forwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===========================================
   DARK MODE (Tema escuro)
   =========================================== */
:root.dark-mode {
  --page-bg: #1e1e1e;
  --shadow: 0 3px 10px rgba(0,0,0,0.6);
  color-scheme: dark;
}

:root.dark-mode body {
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    radial-gradient(circle at 12% 18%, rgba(255,122,0,.20), transparent 31rem),
    radial-gradient(circle at 88% 84%, rgba(255,60,0,.14), transparent 34rem),
    linear-gradient(135deg, #161616, #232323);
  background-attachment: fixed;
  background-repeat: repeat, repeat, no-repeat, no-repeat, no-repeat;
  background-size: 44px 44px, 44px 44px, cover, cover, cover;
  color: #e6e6e6;
}

:root.dark-mode .card {
  background: #2c2c2c;
  color: #e6e6e6;
}
:root.dark-mode .table th {
  background: #333;
  color: #ddd;
}
:root.dark-mode .sidebar {
  background: linear-gradient(180deg, #3a3a3a, #1c1c1c);
}
:root.dark-mode .topbar-main {
  background: #2c2c2c;
}
:root.dark-mode .btn-outline-light {
  color: #ddd !important;
  border-color: #555;
}
:root.dark-mode input,
:root.dark-mode select,
:root.dark-mode textarea {
  background: #333;
  color: #ddd;
  border: 1px solid #555;
}

/* ===========================================
   LOADER PREMIUM NETCOM
   =========================================== */
#loader {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--netcom-orange), var(--netcom-red), var(--netcom-gold));
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  flex-direction: column;
}
#loader.loader-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
  animation: fadeIn 0.8s ease forwards;
}
.loader-logo {
  height: 85px;
  margin-bottom: 10px;
  opacity: 0;
  animation: fadeInUp 1s ease forwards;
}
.loader-text {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeInUp 1s ease 0.3s forwards;
}
.loader-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto;
  opacity: 0;
  animation: fadeInUp 1s ease 0.6s forwards, spin 0.9s linear infinite;
}

.form-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  padding: 28px;
  max-width: 900px;
  margin: 20px auto;
}

.form-card h3 {
  font-weight: 700;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}

.form-card .help-text {
  font-size: .95rem;
  color: #666;
  margin-bottom: 18px;
}

.table-wrapper {
  background: #fff;
  padding: 18px;
  border-radius: 18px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.06);

  /* 🔥 regra de ouro */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}




@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loader no modo escuro */
:root.dark-mode #loader {
  background: linear-gradient(135deg, #111, #292929);
}
:root.dark-mode .loader-text {
  color: var(--netcom-orange);
}
:root.dark-mode .loader-spinner {
  border-color: rgba(255,255,255,0.1);
  border-top-color: var(--netcom-orange-2);
}

/* ===========================================
   RESPONSIVIDADE
   =========================================== */
@media (max-width: 768px) {
  .sidebar {
    left: -240px;
  }
  .sidebar.show {
    left: 0;
  }
  .topbar-main {
    left: 0;
  }
  main.with-sidebar {
    margin-left: 0;
    width: 100%;
    padding-top: 16px;   /* ✅ compacto e limpo */
  }
}
@media (min-width: 1400px) {
  .container-main {
    max-width: 1680px;
  }
}

@media (min-width: 1800px) {
  .container-main {
    max-width: 1760px;
  }
}
  .sidebar {
    box-shadow: 2px 0 14px rgba(0,0,0,0.12);
  }


@media (min-width: 2100px) {
  .container-main {
    max-width: 1920px;
  }
}

/* === Quebra de linha inteligente em telas menores === */
@media (max-width: 1400px) {

  .table td {
    white-space: normal;       /* permite quebra */
    word-break: break-word;    /* evita invadir outra célula */
    line-height: 1.25;
  }

  /* Nome pode quebrar mais */
  td:nth-child(3) {
    white-space: normal;
  }

  /* Vendedor também */
  td:nth-child(4) {
    white-space: normal;
  }
}

@media (max-width: 1200px) {

  .card-filtro .col-md-6.text-end {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 10px;
  }

}

@media (max-width: 1200px) {
  .fab-add {
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  .fab-add {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 1400px) {
  .table th {
    font-size: 0.72rem;
  }
  .table td {
    font-size: 0.82rem;
  }
}




/* Destaque para o botão Importar Planilha */
.import-highlight a {
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
  color: #fff !important;
  font-weight: 600;
  border-radius: 8px;
  margin: 8px 16px;
  padding: 10px 15px;
  text-align: center;
  display: block;
  transition: 0.2s;
}
.import-highlight a:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* Evita quebra de linha na célula de ações */
.table td.actions-cell {
  white-space: nowrap;
}

/* Compactar botões */
.btn-action {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* Ícones menores dentro dos botões */
.btn-action i {
  font-size: 0.9rem;
}
.actions-cell {
  width: 1%;
  white-space: nowrap;
}


/* ===== Paginação automática para PDF / impressão ===== */

table {
  page-break-inside: auto;
  width: 100%;
}

thead {
  display: table-header-group; /* repete cabeçalho a cada página */
}

tfoot {
  display: table-footer-group;
}

tr {
  page-break-inside: avoid; /* não corta linha no meio */
  page-break-after: auto;
}

/* força nova página quando necessário (se quiser usar manual depois) */
.page-break {
  page-break-before: always;
}

/* melhora impressão de cores */
@media print {
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ===== SIDEBAR RETRÁTIL ===== */

.sidebar {
  width: 240px;
  transition: width 0.3s ease;
}

.sidebar.collapsed {
  width: 78px;
}

/* logo */
.sidebar-logo {
  height: 90px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-logo {
  height: 45px;
  max-width: 56px;
}

/* título */
.sidebar-title {
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-title {
  opacity: 0;
  pointer-events: none;
}

/* botão toggle */
.sidebar-toggle {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 20px;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  margin-top: 8px;
}

/* links */
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-submenu-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-weight: 500;
  text-align: left;
  transition: background 0.2s;
}

.sidebar-submenu-toggle:hover {
  background: rgba(255,255,255,0.15);
}

.sidebar-menu li.active > .sidebar-submenu-toggle {
  background: rgba(0,0,0,0.25);
  font-weight: 600;
}

.submenu-arrow {
  margin-left: auto;
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.sidebar-submenu.open > .sidebar-submenu-toggle .submenu-arrow {
  transform: rotate(180deg);
}

.sidebar-submenu-list {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  background: rgba(0,0,0,0.12);
}

.sidebar-submenu.open > .sidebar-submenu-list {
  display: block;
}

.sidebar-submenu-list li a {
  padding-left: 34px;
  font-size: 0.94rem;
}

.sidebar-submenu-list li.active a {
  background: rgba(0,0,0,0.25);
  font-weight: 600;
}

/* ícones sempre visíveis */
.sidebar-menu .icon {
  font-size: 18px;
  min-width: 24px;
  text-align: center;
}

/* texto some no modo compacto */
.sidebar.collapsed .text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* animação suave */
.sidebar .text {
  transition: opacity 0.2s ease;
}

/* ajustar conteúdo quando recolher */
body.sidebar-collapsed .sidebar {
  width: 78px;
}

body.sidebar-collapsed .sidebar-logo {
  height: 45px;
  max-width: 56px;
}

body.sidebar-collapsed .sidebar-title {
  opacity: 0;
  pointer-events: none;
}

body.sidebar-collapsed .text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

body.sidebar-collapsed .submenu-arrow {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-submenu-list {
  display: none;
}

body.sidebar-collapsed .topbar-main {
  left: 78px;
}

body.sidebar-collapsed main.with-sidebar {
  margin-left: 78px;
  width: calc(100% - 78px);
}

.container-main > * {
  margin-bottom: 24px;
}

.container-main > :first-child {
  margin-top: 8px;
}

/* Nome */
th:nth-child(3),
td:nth-child(3) {
  width: 18%;
}

/* Vendedor */
th:nth-child(4),
td:nth-child(4) {
  width: 14%;
}

/* Cidade */
th:nth-child(9),
td:nth-child(9) {
  width: 12%;
}

/* Campanha */
th:nth-child(10),
td:nth-child(10) {
  width: 16%;
}

/* Cadastrado por */
th:nth-child(11),
td:nth-child(11) {
  width: 14%;
}


/* ID */
th:nth-child(1),
td:nth-child(1) {
  width: 70px;
  text-align: center;
}

/* Data */
th:nth-child(2),
td:nth-child(2) {
  width: 110px;
}

/* Plano */
th:nth-child(5),
td:nth-child(5) {
  width: 90px;
  text-align: center;
}

/* Status Atendimento */
th:nth-child(6),
td:nth-child(6) {
  width: 140px;
}

/* Venda Concluída */
th:nth-child(7),
td:nth-child(7) {
  width: 110px;
  text-align: center;
}

/* Telefone */
th:nth-child(8),
td:nth-child(8) {
  width: 140px;
}

/* Ações — compacto (somente ⋮) */
th:nth-child(12),
td:nth-child(12) {
  width: 60px;          /* largura mínima segura */
  min-width: 60px;
  max-width: 80px;
  text-align: center;
  white-space: nowrap;
}

/* === Quebra correta para TÍTULO (Campanhas) === */
th:nth-child(2),
td:nth-child(2) {
  white-space: normal !important;   /* permite quebra de linha */
  word-break: break-word;           /* quebra palavras longas */
  overflow-wrap: anywhere;          /* força quebra se necessário */
  line-height: 1.25;
}

/* Nome */
td:nth-child(3),
th:nth-child(3),

/* Vendedor */
td:nth-child(4),
th:nth-child(4),

/* Plano */
td:nth-child(5),
th:nth-child(5),

/* Cidade */
td:nth-child(9),
th:nth-child(9) {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

/* ID e IXC ficam em linha única */
td:nth-child(1),
td:nth-child(2) {
  white-space: nowrap;
}

/* ===== CAMPANHA – quebra bonita e controlada ===== */
td.campaign-cell,
th.campaign-cell {
  white-space: normal !important;
  vertical-align: middle;
}

/* badge da campanha */
/* ===== BADGE DE CAMPANHA (visual premium) ===== */
.badge-campaign {
  display: inline-block;
  max-width: 100%;
  padding: 6px 10px;

  background: linear-gradient(90deg, #2563eb, #1e40af);
  color: #fff;

  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;

  border-radius: 8px;

  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;

  text-align: center;
}



/* notebooks menores */
@media (max-width: 1366px) {
  th:nth-child(9),
  td:nth-child(9), /* Cidade */

  th:nth-child(11),
  td:nth-child(11) /* Cadastrado por */ {
    display: none;
  }
}

/* telas ainda menores */
@media (max-width: 1200px) {
  th:nth-child(8),
  td:nth-child(8) { /* Telefone */
    display: none;
  }
}

/* ===========================================
   EXTRAS
   =========================================== */
.text-netcom-orange { color: var(--netcom-orange); }
.badge { border-radius: 6px; padding: 6px 10px; }
.alert { border-radius: 8px; }
hr { border-top: 1px solid #eee; }

/* ===============================
   AÇÕES RESPONSIVAS
   =============================== */

.actions-desktop {
  display: inline-flex;
  gap: 6px;
}

.actions-mobile {
  display: none;
}

/* telas menores: troca botões por dropdown 
@media (max-width: 1200px) {
  .actions-desktop {
    display: none;
  }

  .actions-mobile {
    display: inline-block;
  }
}*/


/* padrão: desktop */
.actions-cell .btn-action {
  display: inline-flex;
}

.actions-cell .actions-dropdown {
  display: none;
}

/* notebooks e menores 
@media (max-width: 1680px) {
  .actions-cell .btn-action {
    display: none; /* ESCONDE botões 
  }

  .actions-cell .actions-dropdown {
    display: inline-block; /* MOSTRA ⋮ 
  }
}*/

/* ===========================================
   AÇÕES — FORÇAR DROPDOWN EM TODAS AS TELAS
   =========================================== */

.actions-desktop {
  display: none !important;
}

.actions-mobile {
  display: inline-block !important;
}

.actions-cell {
  white-space: nowrap;
  width: 1%;
}

.actions-mobile .dropdown-toggle {
  padding: 6px 8px;
  border-radius: 8px;
}

.actions-mobile .dropdown-menu {
  min-width: 140px;
}
