/* =========================================================
   Mobile polish — público (atletas no celular)
   Carregar DEPOIS de mobile.css / estilos das páginas
   ========================================================= */

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

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

img, video, iframe, svg {
  max-width: 100%;
  height: auto;
}

/* Inputs com 16px evitam zoom automático no iOS */
input, select, textarea, button {
  font-size: 16px;
  max-width: 100%;
}

@media (max-width: 1023.98px) {
  .container {
    padding-left: 14px !important;
    padding-right: 14px !important;
    width: 100%;
    max-width: 100%;
  }

  /* Header: menu hambúrguer até tablet */
  .site-header .sh-wrap {
    height: 64px !important;
    gap: 10px !important;
    padding: 0 12px !important;
  }
  .site-header .logo img {
    height: 44px !important;
  }
  .site-header .logo span {
    font-size: 18px !important;
  }
  .site-header .top-links {
    display: none !important;
  }
  .site-header .hamb {
    display: inline-flex !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,.35) !important;
    width: 42px !important;
    height: 42px !important;
    flex-shrink: 0;
  }
  .site-header .search {
    flex: 1 1 auto !important;
    margin: 0 !important;
    max-width: none !important;
  }
  .site-header .search input {
    display: none;
  }
  .site-header .search .search-btn {
    display: inline-flex !important;
  }
  .site-header .search.is-open input {
    display: block !important;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 50;
    height: 44px;
    font-size: 16px;
  }
  .mobile-menu {
    top: 100% !important;
    z-index: 200 !important;
  }
  .mobile-menu.open {
    display: block !important;
  }
  .site-header .hamb svg path {
    stroke: #ffffff !important;
  }
  .mobile-menu .m-wrap a,
  .mobile-menu .m-wrap button {
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
  }

  /* Home: 1 card por linha no celular estreito */
  .events-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .ev-thumb {
    height: 180px !important;
  }
  .ev-title {
    font-size: 15px !important;
    line-height: 1.3 !important;
  }
  .home .section-title {
    font-size: 18px !important;
    margin: 14px 0 10px !important;
  }

  /* Hero home — altura natural da imagem (sem cortar) */
  .hero .hero-box {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
  }
  .hero .hero-slide.is-active {
    position: relative !important;
    height: auto !important;
  }
  .hero .hero-slide-img {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
  }
  .hero-title,
  .hero-sub,
  .hero-cta {
    display: none !important;
  }
}

@media (min-width: 481px) and (max-width: 767.98px) {
  .events-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* ===== Inscrição esportiva ===== */
@media (max-width: 768px) {
  .sr-wrap {
    margin: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
  }
  .sr-header {
    padding: 20px 16px !important;
  }
  .sr-header h1 {
    font-size: 18px !important;
    line-height: 1.25 !important;
  }
  .sr-header p {
    font-size: 13px !important;
  }
  .sr-body {
    padding: 18px 14px 28px !important;
  }
  .sr-form-section {
    margin-bottom: 28px !important;
  }
  .sr-section-title {
    font-size: 13px !important;
    margin-bottom: 16px !important;
    flex-wrap: wrap;
  }
  .sr-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .sr-modality-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .sr-modality-card {
    padding: 16px !important;
  }
  .sr-total-box {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
    padding: 16px !important;
    position: sticky;
    bottom: 0;
    z-index: 20;
  }
  .sr-total-value {
    font-size: 22px !important;
  }
  .sr-actions {
    flex-direction: column !important;
    gap: 10px !important;
    margin-top: 24px !important;
    padding-top: 20px !important;
  }
  .btn-finish,
  .btn-cancel {
    width: 100%;
    padding: 14px 16px !important;
    text-align: center;
  }
  .jj-category-box {
    padding: 14px !important;
  }
  .sr-input,
  .sr-select,
  .sr-textarea {
    min-height: 46px;
    font-size: 16px !important;
  }
  .consent-wrapper {
    align-items: flex-start;
  }
  .consent-text {
    font-size: 13px !important;
    line-height: 1.45 !important;
  }
}

/* ===== Minhas Inscrições ===== */
@media (max-width: 768px) {
  .ck-container {
    margin: 16px auto !important;
    padding: 0 12px !important;
  }
  .ck-header h1 {
    font-size: 20px !important;
  }
  .user-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 14px !important;
    padding: 16px !important;
  }
  .user-card > div[style*="margin-left: auto"] {
    margin-left: 0 !important;
    width: 100%;
  }
  .user-card .btn-receipt {
    width: 100%;
    justify-content: center;
  }
  .order-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .order-body {
    padding: 14px !important;
  }
  .event-title {
    font-size: 16px !important;
  }
  .order-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .order-actions .btn-pay,
  .order-actions .btn-receipt,
  .order-actions a {
    width: 100%;
    justify-content: center;
    margin-right: 0 !important;
  }
  .item-row {
    font-size: 13px !important;
    gap: 10px;
  }
}

/* ===== Checkout PIX ===== */
@media (max-width: 640px) {
  .ck-page {
    padding: 16px 10px 32px !important;
  }
  .ck-title {
    font-size: 22px !important;
  }
  .ck-section {
    padding: 16px 14px 0 !important;
  }
  .ck-actions,
  .ck-actions button,
  #checkoutActions button,
  #btnPix {
    width: 100% !important;
  }
  #qrCodeImg,
  .pix-qr img {
    max-width: min(100%, 260px) !important;
    height: auto !important;
    margin: 0 auto;
    display: block;
  }
  #qrCodeText,
  .pix-copy input {
    font-size: 12px !important;
    word-break: break-all;
  }
}

/* ===== Página do evento ===== */
@media (max-width: 768px) {
  .ev-hero-banner {
    min-height: 0 !important;
    padding-top: 16px !important;
    margin-top: 0 !important;
  }
  .ev-hero-banner .logo-container {
    padding: 12px 10px 20px !important;
  }
  .ev-hero-banner .logo-container img {
    max-height: min(70vh, 640px) !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
  }
  .ev-info-bar {
    margin-top: -24px !important;
    padding: 16px !important;
    gap: 12px !important;
  }
  .ev-info-bar h1 {
    font-size: 20px !important;
    line-height: 1.25 !important;
  }
  .ev-section,
  .ev-side-buttons {
    padding: 16px !important;
  }
  .ev-section h3 {
    font-size: 16px !important;
    margin-bottom: 14px !important;
  }
  .ev-section p {
    font-size: 14px !important;
  }
  .ev-section .price-value {
    font-size: 20px !important;
  }
  .auth-modal {
    padding: 12px !important;
    align-items: flex-start !important;
    overflow-y: auto;
  }
  .auth-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 12px 0 24px !important;
    max-height: none !important;
    padding: 18px 14px !important;
  }
  .auth-tab {
    padding: 12px 8px !important;
    font-size: 12px !important;
  }
}

/* Safe area (iPhone notch) */
@supports (padding: max(0px)) {
  .site-header .sh-wrap {
    padding-left: max(12px, env(safe-area-inset-left)) !important;
    padding-right: max(12px, env(safe-area-inset-right)) !important;
  }
  .mobile-menu .m-wrap {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}
