/* ========================================
   CSS RESPONSIVO PARA MOBILE - GATEWISE
   ======================================== */

/* Base Mobile Styles */
@media screen and (max-width: 767.98px) {
  /* Typography Mobile */
  html {
    font-size: 14px; /* Reduz o tamanho base da fonte no mobile */
  }
  
  body {
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Headers Responsivos */
  h1, .h1 {
    font-size: 1.8rem !important;
    line-height: 1.2;
    margin-bottom: 1rem;
  }
  
  h2, .h2 {
    font-size: 1.5rem !important;
    line-height: 1.3;
    margin-bottom: 0.875rem;
  }
  
  h3, .h3 {
    font-size: 1.3rem !important;
    line-height: 1.4;
    margin-bottom: 0.75rem;
  }
  
  h4, .h4 {
    font-size: 1.1rem !important;
    line-height: 1.4;
    margin-bottom: 0.625rem;
  }
  
  h5, .h5 {
    font-size: 1rem !important;
    margin-bottom: 0.5rem;
  }
  
  h6, .h6 {
    font-size: 0.9rem !important;
    margin-bottom: 0.5rem;
  }

  /* Parágrafos e texto */
  p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
  }

  /* Container Responsivo */
  .container {
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100%;
  }
  
  .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
  }

  /* Seções com padding responsivo */
  section {
    padding: 2.5rem 0;
  }
  
  .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  .py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* Botões Mobile-Friendly */
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    min-height: 44px; /* Tamanho mínimo recomendado para toque */
    border-radius: 0.375rem;
    transition: all 0.2s ease;
  }
  
  .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 38px;
  }
  
  .btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    min-height: 50px;
  }

  /* Cards e componentes responsivos */
  .card {
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .card-body {
    padding: 1.25rem;
  }

  /* Imagens responsivas */
  img {
    max-width: 100%;
    height: auto;
  }
  
  .img-fluid {
    max-width: 100%;
    height: auto;
  }

  /* Grid System Mobile */
  .row {
    margin-left: -7.5px;
    margin-right: -7.5px;
  }
  
  .row > * {
    padding-left: 7.5px;
    padding-right: 7.5px;
  }

  /* Formulários Mobile */
  .form-control {
    padding: 0.75rem;
    font-size: 1rem;
    min-height: 44px;
    border-radius: 0.375rem;
  }
  
  .form-select {
    padding: 0.75rem;
    font-size: 1rem;
    min-height: 44px;
  }
  
  .form-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
  }
  
  /* Input groups mobile */
  .input-group {
    flex-wrap: nowrap;
  }
  
  .input-group-text {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  /* Tables responsivas */
  .table-responsive {
    border: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    font-size: 0.875rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem;
    white-space: nowrap;
  }

  /* Modals Mobile */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100vw - 1rem);
  }
  
  .modal-header,
  .modal-footer {
    padding: 1rem;
  }
  
  .modal-body {
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
  }

  /* Navegação responsiva */
  .navbar-brand img {
    max-height: 30px;
  }
  
  .navbar-nav {
    margin-top: 1rem;
  }
  
  .nav-link {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Dropdowns mobile */
  .dropdown-menu {
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
  }
  
  .dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Footer responsivo */
  .footer {
    padding: 2rem 0;
  }
  
  .footer .row > * {
    margin-bottom: 1.5rem;
  }
  
  .footer-links {
    text-align: center;
  }
  
  .footer-links ul {
    padding-left: 0;
  }
  
  .footer-links li {
    display: inline-block;
    margin: 0 0.5rem;
  }

  /* Utilitários de espaçamento mobile */
  .mb-mobile-2 {
    margin-bottom: 0.5rem !important;
  }
  
  .mb-mobile-3 {
    margin-bottom: 1rem !important;
  }
  
  .mb-mobile-4 {
    margin-bottom: 1.5rem !important;
  }
  
  .mt-mobile-2 {
    margin-top: 0.5rem !important;
  }
  
  .mt-mobile-3 {
    margin-top: 1rem !important;
  }
  
  .mt-mobile-4 {
    margin-top: 1.5rem !important;
  }
  
  .p-mobile-2 {
    padding: 0.5rem !important;
  }
  
  .p-mobile-3 {
    padding: 1rem !important;
  }
  
  .px-mobile-2 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  .py-mobile-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  /* Visibilidade mobile */
  .d-mobile-none {
    display: none !important;
  }
  
  .d-mobile-block {
    display: block !important;
  }
  
  .d-mobile-flex {
    display: flex !important;
  }

  /* Text alignment mobile */
  .text-mobile-center {
    text-align: center !important;
  }
  
  .text-mobile-left {
    text-align: left !important;
  }
}

/* Small Mobile Devices */
@media screen and (max-width: 575.98px) {
  html {
    font-size: 13px;
  }
  
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }
  
  /* Headers ainda menores para telas muito pequenas */
  h1, .h1 {
    font-size: 1.6rem !important;
  }
  
  h2, .h2 {
    font-size: 1.3rem !important;
  }
  
  h3, .h3 {
    font-size: 1.1rem !important;
  }
  
  /* Botões em tela cheia para mobile pequeno quando necessário */
  .btn-mobile-full {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* Stack columns em telas muito pequenas */
  .col-mobile-12 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  
  /* Seções com menos padding */
  section {
    padding: 2rem 0;
  }
  
  .py-5 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }
}

/* Medium Mobile to Tablet */
@media screen and (min-width: 576px) and (max-width: 767.98px) {
  .container {
    max-width: 540px;
    padding-left: 20px;
    padding-right: 20px;
  }
  
  /* Aproveitar melhor o espaço em tablets pequenos */
  .btn-group-mobile {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .btn-group-mobile .btn {
    flex: 1;
    min-width: 120px;
  }
}

/* Landscape Mobile */
@media screen and (max-width: 767.98px) and (orientation: landscape) {
  /* Ajustes para mobile em landscape */
  .navbar {
    padding: 0.25rem 0;
  }
  
  .modal-dialog {
    margin: 0.25rem;
  }
  
  .modal-body {
    max-height: 60vh;
  }
  
  /* Reduzir altura de elementos em landscape */
  section {
    padding: 1.5rem 0;
  }
  
  .py-5 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
}

/* High DPI Displays */
@media screen and (max-width: 767.98px) and (-webkit-min-device-pixel-ratio: 2) {
  /* Ajustes para telas de alta densidade */
  img {
    image-rendering: -webkit-optimize-contrast;
  }
  
  .btn {
    border-width: 0.5px;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  /* Para dispositivos que não suportam hover (principalmente touch) */
  .btn:hover {
    transform: none;
  }
  
  .card:hover {
    transform: none;
  }
  
  /* Aumentar área de toque para links pequenos */
  a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  
  /* Melhorar feedback de toque */
  .btn:active {
    transform: scale(0.98);
  }
  
  .card:active {
    transform: scale(0.99);
  }
}

/* Accessibility improvements para mobile */
@media screen and (max-width: 767.98px) {
  /* Melhorar contraste para leitura */
  .text-muted {
    color: #666 !important;
  }
  
  /* Focus states mais visíveis */
  .btn:focus,
  .form-control:focus,
  .form-select:focus {
    box-shadow: 0 0 0 3px rgba(23, 92, 255, 0.25);
    outline: none;
  }
  
  /* Skip links para acessibilidade */
  .skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 9999;
  }
  
  .skip-link:focus {
    top: 6px;
  }
}

/* Performance optimizations para mobile */
@media screen and (max-width: 767.98px) {
  /* Reduzir animações complexas */
  * {
    animation-duration: 0.1s !important;
    animation-delay: 0s !important;
    transition-duration: 0.1s !important;
  }
  
  /* Simplificar shadows para melhor performance */
  .shadow {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  }
  
  .shadow-sm {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
  }
  
  .shadow-lg {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
  }
}