/* Casa do Café - Estilos Corporativos Customizados */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --brand-primary: #154c3c;
  --brand-primary-dark: #0e3529;
  --brand-accent: #d97706;
}

body {
  font-family: var(--font-sans);
  background-color: #f8fafc;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Micro-animations */
.fade-in {
  animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Backdrop */
.modal-backdrop {
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

/* Tag Pills Custom States */
.fabricante-pill, .grupo-pill {
  user-select: none;
  cursor: pointer;
}

.fabricante-pill:active, .grupo-pill:active {
  transform: scale(0.97);
}

/* Table Header Sticky */
.sticky-th {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Responsividade Fluida da Tabela sem Scroll Horizontal no Desktop */
@media (min-width: 1280px) {
  #itemsTableContainer > div {
    overflow-x: hidden;
  }
}

/* Quebra suave de texto para até 2 linhas */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Trilho de Rolagem Horizontal sem Scrollbar para Toque / Mobile */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

/* ================================================================= */
/* REGRAS RESPONSIVAS MOBILE (MAX-WIDTH: 768px)                       */
/* ================================================================= */
@media (max-width: 768px) {
  /* 1. Prevenção de Zoom Automático no iOS Safari e Android */
  input[type="text"],
  input[type="date"],
  input[type="search"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* 2. Transformação da Tabela da Grid em Cards Comerciais */
  #itemsTableContainer > div {
    overflow-x: visible !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  #itemsTable {
    display: block !important;
    width: 100% !important;
    border: none !important;
  }

  #itemsTable thead {
    display: none !important;
  }

  #itemsTable tbody {
    display: block !important;
    width: 100% !important;
  }

  #itemsTable tbody tr {
    display: block !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    margin-bottom: 12px !important;
    padding: 14px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    border: 1px solid #e2e8f0 !important;
  }

  #itemsTable tbody tr:hover {
    background: #ffffff !important;
  }

  #itemsTable td.desktop-cell {
    display: none !important;
  }

  #itemsTable td.mobile-card-cell {
    display: block !important;
    padding: 0 !important;
    border: none !important;
  }

  /* 3. Gaveta Full-Screen do Orçamento no Mobile */
  #budgetExpandedDetails.mobile-drawer-open {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
    background: #ffffff !important;
    overflow-y: auto !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
  }
}

/* ================================================================= */
/* REGRAS DESKTOP (MIN-WIDTH: 769px)                                 */
/* ================================================================= */
@media (min-width: 769px) {
  #itemsTable td.mobile-card-cell {
    display: none !important;
  }

  #itemsTable td.desktop-cell {
    display: table-cell !important;
  }
}

/* Print Optimization */
@media print {
  body {
    background: white;
  }
  #headerUserProfile, #simulationDateCard, #filterBlocksContainer, #btnExportCsv, #btnOpenUploadModal, #paginationContainer, #mobileStickyBudgetBar {
    display: none !important;
  }
  .table-container {
    overflow: visible !important;
  }
  table {
    width: 100% !important;
    border-collapse: collapse;
  }
  th, td {
    border: 1px solid #cbd5e1 !important;
    font-size: 10px !important;
    padding: 4px 6px !important;
  }
}


/* Nada pode empurrar a página para os lados no celular (sem quebrar o cabeçalho fixo) */
#appScreen {
  overflow-x: clip;
}
