/* ============================================================================
   GRUPO FALCON - CSS RESPONSIVO GLOBAL
   Mobile-First Approach
   ============================================================================ */

/* ============================================================================
   RESET E BASE
   ============================================================================ */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  overflow-x: hidden;
}

/* ============================================================================
   CONTAINER RESPONSIVO
   ============================================================================ */
.container-responsive {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .container-responsive {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container-responsive {
    padding: 0 2rem;
  }
}

/* ============================================================================
   HEADER RESPONSIVO
   ============================================================================ */
@media (max-width: 767px) {
  /* Header mobile */
  header {
    padding: 0.75rem 1rem !important;
  }
  
  header h1 {
    font-size: 1rem !important;
  }
  
  header .text-xs {
    font-size: 0.65rem !important;
  }
  
  header img {
    height: 32px !important;
  }
  
  header button {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem !important;
  }
}

/* ============================================================================
   GRID RESPONSIVO
   ============================================================================ */
/* Mobile: 1 coluna */
.grid-responsive {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Tablet: 2 colunas */
@media (min-width: 768px) {
  .grid-responsive-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-responsive-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-responsive-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: 3-4 colunas */
@media (min-width: 1024px) {
  .grid-responsive-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid-responsive-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================================================
   CARDS RESPONSIVOS
   ============================================================================ */
@media (max-width: 767px) {
  .card-stats {
    padding: 1rem !important;
  }
  
  .card-stats h2,
  .card-stats .text-3xl {
    font-size: 1.5rem !important;
  }
  
  .card-stats .text-sm {
    font-size: 0.75rem !important;
  }
  
  .card-stats .w-14 {
    width: 2.5rem !important;
    height: 2.5rem !important;
  }
  
  .card-stats .text-2xl {
    font-size: 1.25rem !important;
  }
}

/* ============================================================================
   TABELAS RESPONSIVAS
   ============================================================================ */
@media (max-width: 767px) {
  /* Scroll horizontal em tabelas */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
    font-size: 0.75rem !important;
  }
  
  table th,
  table td {
    padding: 0.5rem !important;
    white-space: nowrap;
  }
  
  /* Ocultar colunas menos importantes */
  .hide-mobile {
    display: none !important;
  }
}

/* ============================================================================
   BOTÕES RESPONSIVOS
   ============================================================================ */
@media (max-width: 767px) {
  /* Botões empilhados */
  .button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .button-group button {
    width: 100%;
  }
  
  /* Botões menores */
  button {
    font-size: 0.875rem !important;
    padding: 0.5rem 1rem !important;
  }
  
  button i {
    font-size: 0.875rem !important;
  }
}

/* ============================================================================
   FORMULÁRIOS RESPONSIVOS
   ============================================================================ */
@media (max-width: 767px) {
  .form-group {
    margin-bottom: 1rem !important;
  }
  
  label {
    font-size: 0.875rem !important;
    margin-bottom: 0.25rem !important;
  }
  
  input,
  select,
  textarea {
    font-size: 0.875rem !important;
    padding: 0.5rem !important;
  }
}

/* ============================================================================
   MODAIS RESPONSIVOS
   ============================================================================ */
@media (max-width: 767px) {
  .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    margin: 1rem !important;
  }
  
  .modal-header h2 {
    font-size: 1.25rem !important;
  }
  
  .modal-body {
    padding: 1rem !important;
  }
  
  .modal-footer {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  
  .modal-footer button {
    width: 100% !important;
  }
}

/* ============================================================================
   GRÁFICOS RESPONSIVOS
   ============================================================================ */
@media (max-width: 767px) {
  .chart-container {
    height: 200px !important;
    margin-bottom: 1rem !important;
  }
  
  canvas {
    max-height: 200px !important;
  }
}

/* ============================================================================
   FILTROS E BUSCA RESPONSIVOS
   ============================================================================ */
@media (max-width: 767px) {
  .filter-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .filter-container select,
  .filter-container input {
    width: 100%;
  }
  
  .search-bar {
    width: 100%;
  }
}

/* ============================================================================
   PAGINAÇÃO RESPONSIVA
   ============================================================================ */
@media (max-width: 767px) {
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem !important;
  }
  
  .pagination button {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem !important;
  }
  
  .pagination span {
    font-size: 0.75rem !important;
  }
}

/* ============================================================================
   TEXTO RESPONSIVO
   ============================================================================ */
@media (max-width: 767px) {
  h1 {
    font-size: 1.5rem !important;
  }
  
  h2 {
    font-size: 1.25rem !important;
  }
  
  h3 {
    font-size: 1.125rem !important;
  }
  
  .text-3xl {
    font-size: 1.5rem !important;
  }
  
  .text-2xl {
    font-size: 1.25rem !important;
  }
  
  .text-xl {
    font-size: 1.125rem !important;
  }
}

/* ============================================================================
   ESPAÇAMENTO RESPONSIVO
   ============================================================================ */
@media (max-width: 767px) {
  .mb-6 {
    margin-bottom: 1rem !important;
  }
  
  .p-6 {
    padding: 1rem !important;
  }
  
  .p-8 {
    padding: 1.5rem !important;
  }
  
  .px-6 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .py-6 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
}

/* ============================================================================
   OCULTAR/MOSTRAR POR DEVICE
   ============================================================================ */
.mobile-only {
  display: block;
}

.desktop-only {
  display: none;
}

@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
  
  .desktop-only {
    display: block;
  }
}

/* ============================================================================
   FLEX RESPONSIVO
   ============================================================================ */
@media (max-width: 767px) {
  .flex-responsive {
    flex-direction: column !important;
  }
  
  .flex-responsive > * {
    width: 100% !important;
  }
}

/* ============================================================================
   ALERTAS E BADGES RESPONSIVOS
   ============================================================================ */
@media (max-width: 767px) {
  .alert,
  .badge {
    font-size: 0.75rem !important;
    padding: 0.5rem !important;
  }
}

/* ============================================================================
   SIDEBAR/DRAWER MOBILE
   ============================================================================ */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100vh;
    background: white;
    z-index: 9999;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
  }
  
  .sidebar-overlay.open {
    display: block;
  }
}

/* ============================================================================
   SCROLL SUAVE
   ============================================================================ */
html {
  scroll-behavior: smooth;
}

/* ============================================================================
   ACESSIBILIDADE TOUCH
   ============================================================================ */
@media (max-width: 767px) {
  /* Aumentar área de toque */
  button,
  a,
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ============================================================================
   VIEWPORT META (suporte iOS)
   ============================================================================ */
@supports (-webkit-touch-callout: none) {
  body {
    min-height: -webkit-fill-available;
  }
}
