/**
 * utilities.css
 * Classes utilitárias customizadas para substituir inline styles
 * Complementa as utilidades do Bootstrap 5
 * 
 * @version 2.0
 * @date 11/12/2025
 * @changelog Adicionadas classes para padronização de estilos inline
 */

/* ======================
   LARGURAS PADRONIZADAS
   ====================== */

.w-input-sm { width: 200px !important; }
.w-input-md { width: 300px !important; }
.w-input-lg { width: 400px !important; }

.max-w-input-sm { max-width: 200px !important; }
.max-w-input-md { max-width: 300px !important; }
.max-w-input-lg { max-width: 400px !important; }

/* ======================
   ALTURAS PADRONIZADAS
   ====================== */

.h-textarea-sm { height: 80px !important; }
.h-textarea-md { height: 100px !important; }
.h-textarea-lg { height: 150px !important; }

.h-progress-sm { height: 20px !important; }
.h-progress-md { height: 30px !important; }
.h-progress-lg { height: 40px !important; }

/* ======================
   SCROLL CONTAINERS
   ====================== */

.scroll-y-xs { max-height: 150px; overflow-y: auto; }
.scroll-y-sm { max-height: 200px; overflow-y: auto; }
.scroll-y-md { max-height: 400px; overflow-y: auto; }
.scroll-y-lg { max-height: 600px; overflow-y: auto; }
.scroll-y-xl { max-height: 800px; overflow-y: auto; }

/* ======================
   TAMANHOS DE ÍCONES
   ====================== */

.icon-xs { font-size: 0.875rem !important; }
.icon-sm { font-size: 1.25rem !important; }
.icon-md { font-size: 1.5rem !important; }
.icon-lg { font-size: 2rem !important; }
.icon-xl { font-size: 3rem !important; }
.icon-xxl { font-size: 4rem !important; }

/* ======================
   LARGURAS DE TABELA
   ====================== */

.th-w-10 { width: 10% !important; }
.th-w-15 { width: 15% !important; }
.th-w-20 { width: 20% !important; }
.th-w-25 { width: 25% !important; }
.th-w-30 { width: 30% !important; }
.th-w-40 { width: 40% !important; }
.th-w-50 { width: 50% !important; }

.th-w-fixed-sm { width: 100px !important; }
.th-w-fixed-md { width: 150px !important; }
.th-w-fixed-lg { width: 200px !important; }

/* ======================
   LARGURAS DE OFFCANVAS
   ====================== */

.offcanvas-w-sm { width: 320px !important; }
.offcanvas-w-md { width: 480px !important; }
.offcanvas-w-lg { width: 640px !important; }
.offcanvas-w-xl { width: 800px !important; }

@media (max-width: 768px) {
  .offcanvas-w-sm,
  .offcanvas-w-md,
  .offcanvas-w-lg,
  .offcanvas-w-xl {
    width: 100% !important;
  }
}

/* ======================
   TAMANHOS DE CHECKBOX/SWITCH
   ====================== */

.form-check-input-lg {
  width: 3em !important;
  height: 1.5em !important;
}

.form-check-input-xl {
  width: 4em !important;
  height: 2em !important;
}

/* ======================
   LIMITES DE ALTURA
   ====================== */

.min-h-100 { min-height: 100px !important; }
.min-h-200 { min-height: 200px !important; }
.min-h-300 { min-height: 300px !important; }
.min-h-400 { min-height: 400px !important; }
.min-h-500 { min-height: 500px !important; }
.min-h-600 { min-height: 600px !important; }

/* ======================
   PERFIL / AVATAR
   ====================== */

.avatar-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
}

.avatar-img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-color, #0d6efd);
  background: #f5f5f5;
}

[data-bs-theme="dark"] .avatar-img {
  background: #2d3748;
  border-color: var(--bs-primary);
}

/* ======================
   TEXTOS AUXILIARES
   ====================== */

.small-note {
  font-size: 0.75rem;
  color: var(--bs-secondary, #666);
}

[data-bs-theme="dark"] .small-note {
  color: var(--bs-gray-400, #9ca3af);
}

/* ======================
   DIVISORES
   ====================== */

.section-divider {
  border-top: 1px dashed var(--bs-border-color, #ddd);
  margin: 30px 0 25px;
}

.section-divider-solid {
  border-top: 1px solid var(--bs-border-color, #eee);
  margin: 20px 0;
}

/* ======================
   PREFERÊNCIAS / SETTINGS ROW
   ====================== */

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--bs-border-color, #eee);
}

.pref-row:last-child {
  border-bottom: none;
}

.pref-row-label {
  flex: 1;
}

.pref-row-label strong {
  display: block;
  margin-bottom: 2px;
}

/* ======================
   CONTAINERS COM SCROLL
   ====================== */

.scroll-container-sm {
  max-height: 200px;
  overflow-y: auto;
}

.scroll-container-md {
  max-height: 400px;
  overflow-y: auto;
}

.scroll-container-lg {
  max-height: 600px;
  overflow-y: auto;
}

/* ======================
   INPUT HIDDEN (FILE)
   ====================== */

.input-hidden {
  display: none;
}

/* ======================
   TOAST CONTAINER
   ====================== */

#toast-container {
  z-index: 1080;
}

/* ======================
   STATUS INDICATORS
   ====================== */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot-success {
  background-color: var(--bs-success);
}

.status-dot-warning {
  background-color: var(--bs-warning);
}

.status-dot-danger {
  background-color: var(--bs-danger);
}

.status-dot-info {
  background-color: var(--bs-info);
}

/* ======================
   BADGE COUNTER
   ====================== */

.badge-counter {
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 0.65rem;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* ======================
   CARD VARIANTS
   ====================== */

.card-clickable {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-highlight {
  border-left: 4px solid var(--bs-primary);
}

.card-highlight-success {
  border-left: 4px solid var(--bs-success);
}

.card-highlight-warning {
  border-left: 4px solid var(--bs-warning);
}

.card-highlight-danger {
  border-left: 4px solid var(--bs-danger);
}

/* ======================
   FORM HELPERS
   ====================== */

.form-label-required::after {
  content: ' *';
  color: var(--bs-danger);
}

/* ======================
   FLEX UTILITIES EXTRAS
   ====================== */

.gap-xs {
  gap: 0.25rem;
}

.gap-xxl {
  gap: 2rem;
}

/* ======================
   ANIMATION CLASSES
   ====================== */

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

.slide-in-up {
  animation: slideInUp 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { 
    opacity: 0;
    transform: translateX(20px);
  }
  to { 
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Respeita preferência de motion reduzido */
@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .slide-in-right,
  .slide-in-up {
    animation: none;
  }
}

/* ======================
   LOADING STATES
   ====================== */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

[data-bs-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text-sm {
  height: 0.75em;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* ======================
   Z-INDEX LAYERS
   ====================== */

.z-dropdown { z-index: 1000; }
.z-sticky { z-index: 1020; }
.z-fixed { z-index: 1030; }
.z-modal-backdrop { z-index: 1040; }
.z-modal { z-index: 1050; }
.z-popover { z-index: 1060; }
.z-tooltip { z-index: 1070; }
.z-toast { z-index: 1080; }
.z-max { z-index: 9999; }

/* ======================
   REPORTS PAGE STYLES
   ====================== */

/* Header da página de relatórios */
.reports-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

[data-bs-theme="dark"] .reports-header {
  border-bottom-color: var(--bs-gray-700, #4b5563);
}

/* Cards de KPI */
#reports-summary-section .card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#reports-summary-section .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] #reports-summary-section .card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Formulário de filtros */
#reports-filter-form .form-label {
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

/* Multi-select styling */
#reports-status-select,
#reports-vendor-select {
  min-height: 100px;
}

#reports-status-select option:checked,
#reports-vendor-select option:checked {
  background-color: var(--bs-primary);
  color: white;
}

/* Tabelas dentro de relatórios */
#page-relatorios .table thead th {
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--bs-gray-600, #666);
}

[data-bs-theme="dark"] #page-relatorios .table thead th {
  color: var(--bs-gray-400, #9ca3af);
}

#page-relatorios .table tbody td {
  vertical-align: middle;
}

/* Sticky header para tabelas com scroll */
#page-relatorios .sticky-top {
  background-color: var(--bs-light, #f8f9fa);
}

[data-bs-theme="dark"] #page-relatorios .sticky-top {
  background-color: var(--bs-gray-800, #1f2937);
}

/* Canvas de gráficos */
#page-relatorios canvas {
  max-height: 250px;
}

/* Estado vazio */
#reports-empty-state {
  background-color: var(--bs-light, #f8f9fa);
  border-radius: 0.5rem;
  margin: 2rem 0;
}

[data-bs-theme="dark"] #reports-empty-state {
  background-color: var(--bs-gray-800, #1f2937);
}

/* Animação de loading para botões */
#page-relatorios .btn .spinner-border {
  vertical-align: text-bottom;
}

/* Cards de SLA */
#sla .border {
  transition: background-color 0.2s ease;
}

#sla .border:hover {
  background-color: var(--bs-gray-100, #f8f9fa);
}

[data-bs-theme="dark"] #sla .border:hover {
  background-color: var(--bs-gray-700, #374151);
}

/* Grid de campos para exportação personalizada */
#report-fields-container .form-check {
  padding: 0.5rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.375rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

#report-fields-container .form-check:hover {
  background-color: var(--bs-gray-100, #f8f9fa);
  border-color: var(--bs-primary);
}

#report-fields-container .form-check-input:checked + .form-check-label {
  font-weight: 600;
}

[data-bs-theme="dark"] #report-fields-container .form-check:hover {
  background-color: var(--bs-gray-700, #374151);
}

/* Responsividade */
@media (max-width: 768px) {
  .reports-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .reports-header > div:last-child {
    width: 100%;
  }
  
  #reports-summary-section .card-body {
    padding: 0.75rem;
  }
  
  #reports-summary-section .card-body h3 {
    font-size: 1.25rem;
  }
  
  #reports-summary-section .card-body h6 {
    font-size: 0.75rem;
  }
  
  #page-relatorios canvas {
    max-height: 180px;
  }
}

/* Print styles para relatórios */
@media print {
  #page-relatorios .btn,
  #page-relatorios .reports-header > div:last-child,
  #page-relatorios #reports-filters-collapse,
  #page-relatorios #custom-export-collapse,
  #page-relatorios .card-header button {
    display: none !important;
  }
  
  #page-relatorios .card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
  
  #page-relatorios .collapse {
    display: block !important;
  }
}

/* === Classes de Altura Mínima para Modais e Tabs === */
.min-h-modal-lg {
  min-height: 600px;
}

.min-h-modal-md {
  min-height: 500px;
}

.min-h-tab-content {
  min-height: 500px;
}

.min-h-tab-pane {
  min-height: 400px;
}

/* === Classes de Largura para Colunas de Tabela === */
.th-w-120 {
  width: 120px;
}

.th-w-150 {
  width: 150px;
}

.th-w-80 {
  width: 80px;
}

/* Larguras percentuais */
.th-w-5 {
  width: 5%;
}

.th-w-10 {
  width: 10%;
}

.th-w-15 {
  width: 15%;
}

.th-w-30 {
  width: 30%;
}

/* === Classes de Texto === */
.text-pre-wrap {
  white-space: pre-wrap;
}

/* === Classes de Badge === */
.badge-lg {
  font-size: 1rem;
  padding: 0.5rem 1rem;
}

/* === Scrollbars customizados === */
.scroll-y-xs {
  max-height: 200px;
  overflow-y: auto;
}

.scroll-y-220 {
  max-height: 220px;
  overflow-y: auto;
}

.scroll-y-sm {
  max-height: 250px;
  overflow-y: auto;
}

.scroll-y-300 {
  max-height: 300px;
  overflow-y: auto;
}

.scroll-y-360 {
  max-height: 360px;
  overflow-y: auto;
}

.scroll-y-md {
  max-height: 400px;
  overflow-y: auto;
}

.scroll-y-420 {
  max-height: 420px;
  overflow-y: auto;
}

.scroll-y-lg {
  max-height: 500px;
  overflow-y: auto;
}

/* === Classes de altura mínima === */
.min-h-60 {
  min-height: 60px;
}

.min-h-progress {
  min-height: 24px;
}


.modal-w-sm {
  max-width: 400px;
}

.modal-w-md {
  max-width: 600px;
}

.modal-w-700 {
  max-width: 700px;
}

.modal-w-lg {
  max-width: 760px;
}

.modal-w-xl {
  max-width: 950px;
}

/* === Classes de largura para filtros e inputs === */
.w-filter-md {
  width: 250px;
}

/* === Classes de largura para colunas de tabela (pixels) === */
.th-w-45 {
  width: 45px;
}

.th-w-50 {
  width: 50px;
}

.th-w-70 {
  width: 70px;
}

.th-w-90 {
  width: 90px;
}

.th-w-120 {
  width: 120px;
}

.th-w-150 {
  width: 150px;
}

.th-w-200 {
  width: 200px;
}

/* Larguras mínimas */
.th-min-w-150 {
  min-width: 150px;
}

.th-min-w-180 {
  min-width: 180px;
}

/* === Classes de altura mínima === */
.min-h-progress {
  min-height: 24px;
}

/* === Ícones === */
.icon-lg {
  font-size: 2.5rem;
}

/* === Cursor === */
.cursor-help {
  cursor: help;
}

/* === Grid Layouts === */
.grid-cols-auto-fit-220 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

/* === Dropzone === */
.dropzone-style {
  border: 2px dashed #dee2e6;
  background-color: #f8f9fa;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dropzone-style:hover {
  border-color: var(--primary-color, #0d6efd);
  background-color: #e7f1ff;
}

[data-theme="dark"] .dropzone-style {
  border-color: #495057;
  background-color: #212529;
}

[data-theme="dark"] .dropzone-style:hover {
  border-color: var(--primary-color, #0d6efd);
  background-color: #1a2332;
}

/* === Sticky Positioning === */
.sticky-offset-sm {
  position: sticky;
  top: 1.25rem;
}

