/* ════════════════════════════════════════════════════════════════
   LFT CRM — style_v15.css
   Responsividade iPad/Tablet + melhorias visuais gerais
   ════════════════════════════════════════════════════════════════ */

/* ── BARRA DE PESQUISA GLOBAL (ampliar) ─────────────────────────── */
#global-search,
.search-bar input[type="text"],
.global-search-input,
input[placeholder*="Buscar"],
input[placeholder*="buscar"],
input[placeholder*="Pesquisar"],
input[placeholder*="pesquisar"] {
  min-width: 260px !important;
  width: clamp(260px, 35vw, 480px) !important;
}

/* ── BARRAS DE EVENTO NO CALENDÁRIO (altura maior) ──────────────── */
.cal-event,
.calendar-event,
[class*="cal-evt"],
[class*="event-bar"],
.v14-cal-event,
.fc-event,
.week-event {
  min-height: 26px !important;
  line-height: 1.4 !important;
  padding: 3px 7px !important;
  font-size: 12px !important;
  border-radius: 5px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* ── PIPELINE KANBAN — scroll horizontal em tablets ──────────────── */
.kanban-board,
#kanban-board,
[id*="kanban"],
.pipeline-board,
.page-pipeline > .board-wrap,
#page-pipelines .board-container {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
}

.kanban-column,
.pipeline-column,
.board-column {
  min-width: 260px !important;
  flex-shrink: 0 !important;
  scroll-snap-align: start;
}

/* ── TABELAS — scroll horizontal em tablets ──────────────────────── */
.table-wrap,
.table-responsive,
#page-clients .clients-table-wrap,
#page-clients table {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  display: block;
  width: 100%;
}

/* ── LAYOUT PRINCIPAL — responsivo ──────────────────────────────── */

/* TABLET PORTRAIT (768px – 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {

  /* Sidebar: esconder labels, só ícones — já que telas são menores */
  #sidebar {
    width: 64px !important;
    min-width: 64px !important;
  }
  #sidebar .nav-label,
  #sidebar .sidebar-company,
  #sidebar .sidebar-logo-text,
  #sidebar [class*="company-name"] {
    display: none !important;
  }
  #sidebar .nav-item {
    justify-content: center !important;
    padding: 10px 8px !important;
  }
  #sidebar .nav-item svg,
  #sidebar .nav-item .nav-icon {
    min-width: 22px !important;
  }

  /* Conteúdo principal: ocupa o espaço restante */
  #app,
  .app-layout,
  .main-content,
  #main-content {
    margin-left: 64px !important;
  }

  /* Pipeline kanban: scroll horizontal */
  .kanban-board,
  #kanban-board {
    overflow-x: scroll !important;
    cursor: grab;
  }
  .kanban-board:active {
    cursor: grabbing;
  }

  /* Modal: largura quase toda a tela */
  .modal,
  .modal-overlay .modal-box,
  [class*="modal-container"] {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 10px auto !important;
  }

  /* Tabela de clientes: scroll */
  #page-clients table,
  #clients-table {
    min-width: 900px;
  }

  /* WhatsApp: lista de chats + conversa empilhados */
  .wa-layout,
  #page-whatsapp .wa-wrap,
  .wa-container {
    flex-direction: column !important;
  }
  .wa-sidebar,
  .wa-contact-list,
  [class*="wa-list"] {
    width: 100% !important;
    max-height: 40vh !important;
    overflow-y: auto;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .wa-chat-area,
  .wa-messages,
  [class*="wa-chat"] {
    width: 100% !important;
    flex: 1 !important;
  }

  /* Página de Inbox: cards em coluna */
  .inbox-grid,
  #page-inbox .grid {
    grid-template-columns: 1fr !important;
  }

  /* Dashboard: 2 colunas em vez de 3+ */
  .dashboard-grid,
  #page-dashboard .stats-grid,
  .stats-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Cabeçalho de página */
  .page-header {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* Form rows: empilhar em mobile */
  .form-row {
    flex-direction: column !important;
  }

  /* Barra de pesquisa global: largura total */
  #global-search,
  .search-bar input {
    width: 100% !important;
    min-width: unset !important;
  }
}

/* TABLET LANDSCAPE (1025px – 1180px) */
@media (min-width: 1025px) and (max-width: 1180px) {
  .kanban-board,
  #kanban-board {
    overflow-x: auto !important;
  }
  .kanban-column,
  .board-column {
    min-width: 230px !important;
  }
  #page-clients table {
    min-width: 800px;
    overflow-x: auto;
    display: block;
  }
}

/* MOBILE (< 768px) */
@media (max-width: 767px) {
  #sidebar {
    position: fixed !important;
    z-index: 200 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s ease;
  }
  #sidebar.open {
    transform: translateX(0) !important;
  }
  #app,
  .app-layout,
  .main-content {
    margin-left: 0 !important;
  }
  .kanban-board {
    overflow-x: scroll !important;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-column {
    min-width: 240px !important;
  }
  .modal,
  .modal-box {
    width: 98vw !important;
    max-width: 98vw !important;
    margin: 4px auto !important;
  }
  .modal-body {
    max-height: 75vh !important;
    overflow-y: auto !important;
  }
  .form-row {
    flex-direction: column !important;
  }
}

/* ── INDICADOR DE SCROLL EM TABELAS (barra de rolagem estilizada) ── */
#clients-table,
.kanban-board,
.table-responsive {
  scrollbar-width: thin;
  scrollbar-color: var(--primary, #1a56db) var(--bg2, #1e2430);
}
#clients-table::-webkit-scrollbar,
.kanban-board::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}
#clients-table::-webkit-scrollbar-track,
.kanban-board::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
  background: var(--bg2, #1e2430);
  border-radius: 3px;
}
#clients-table::-webkit-scrollbar-thumb,
.kanban-board::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background: var(--primary, #1a56db);
  border-radius: 3px;
}

/* ── FILTROS DE CLIENTES v15 ─────────────────────────────────────── */
#v15-client-filters {
  animation: slideDown 0.2s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#v15-client-filters input,
#v15-client-filters select {
  transition: border-color 0.2s;
}
#v15-client-filters input:focus,
#v15-client-filters select:focus {
  border-color: var(--primary) !important;
  outline: none;
}

/* ── BLOCO DE MÓDULOS v15 NO MODAL DO USUÁRIO ────────────────────── */
#v15-modules-block {
  animation: slideDown 0.25s ease;
  border: 1px solid var(--border);
}
#v15-module-checks label {
  transition: background 0.15s, transform 0.1s;
}
#v15-module-checks label:hover {
  background: var(--bg4) !important;
  transform: scale(1.02);
}

/* ── BOTÃO FAVORITAR NA CONVERSA ────────────────────────────────── */
#v15-fav-btn {
  transition: color 0.2s, transform 0.15s;
}
#v15-fav-btn:hover {
  transform: scale(1.2);
}

/* ── BADGE MODO DEUS — não cobrir o header ───────────────────────── */
#godmode-banner {
  font-size: 13px !important;
}
@media (max-width: 767px) {
  #godmode-banner {
    font-size: 11px !important;
    padding: 6px 10px !important;
    flex-wrap: wrap !important;
  }
}

/* ── MODAL DE AGENDAMENTO v15 ────────────────────────────────────── */
#sf-rec-timer {
  font-variant-numeric: tabular-nums;
  animation: blink-rec 1s infinite;
}
@keyframes blink-rec {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── DIA POR EXTENSO NA AGENDA ───────────────────────────────────── */
.v15-today-label {
  font-size: 12px;
  color: var(--text3);
  font-weight: 400;
  display: block;
  line-height: 1.3;
}

/* ── BADGE SINISTRO — cursor pointer ─────────────────────────────── */
.sinistro-badge,
[class*="sinistro-badge"] {
  cursor: pointer !important;
  transition: opacity 0.2s;
}
.sinistro-badge:hover {
  opacity: 0.8;
}
