/* ===== Mind Mentor 360 — sistema responsivo global ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
}

img,
video,
svg,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

table {
  max-width: 100%;
}

.table-responsive,
.mm-scroll-x {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

input,
select,
textarea,
button {
  max-width: 100%;
  font-size: 16px; /* evita zoom automático no iOS */
}

.container,
.container-fluid,
.hm-container,
.mp-shell,
.mm-site-nav-inner {
  max-width: 100%;
}

/* Formulários Bootstrap em telas estreitas */
@media (max-width: 767.98px) {
  .row > [class*="col-"] {
    margin-bottom: 0.35rem;
  }

  .btn,
  .hm-btn,
  .mp-btn,
  .mm-site-btn {
    min-height: 44px;
  }

  .form-control,
  .form-select,
  textarea.form-control {
    min-height: 44px;
  }

  .d-flex.gap-2,
  .d-flex.gap-3 {
    flex-wrap: wrap;
  }

  /* Chat / inbox */
  #thread,
  #inboxThread,
  .chat-messages {
    max-height: min(55vh, 420px) !important;
  }

  form.d-flex:has(#msg),
  form.d-flex:has(#messageInput),
  #chatForm {
    flex-wrap: nowrap;
    width: 100%;
  }

  #chatForm .form-control,
  #msg,
  #messageInput {
    min-width: 0;
    flex: 1 1 auto;
  }

  #chatForm .btn,
  form.d-flex .btn {
    flex: 0 0 auto;
  }

  /* Login logo grande */
  .auth-logo img,
  .login-logo img,
  img[alt="Mind Mentor 360"][height="240"],
  img[style*="width:240px"] {
    width: min(160px, 42vw) !important;
    height: min(160px, 42vw) !important;
  }

  /* Cards / grids comuns */
  .card,
  .modal-dialog {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }

  .modal-dialog {
    max-width: calc(100% - 1rem);
  }
}

@media (max-width: 575.98px) {
  .container,
  .container-sm,
  .container-md {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  main.container,
  main.container.py-4,
  main.container.py-5 {
    padding-top: 1.25rem !important;
    padding-bottom: 1.5rem !important;
  }

  h1, .h1 { font-size: clamp(1.45rem, 7vw, 1.85rem); }
  h2, .h2 { font-size: clamp(1.25rem, 6vw, 1.55rem); }
  h3, .h3 { font-size: clamp(1.1rem, 5vw, 1.3rem); }

  .btn-group {
    flex-wrap: wrap;
    width: 100%;
  }

  .btn-group > .btn {
    flex: 1 1 auto;
  }
}

/* Landscape phones */
@media (max-height: 480px) and (orientation: landscape) {
  .hm-hero {
    min-height: auto;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
  }

  .mm-site-nav-inner {
    min-height: 64px;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }
}

/* Preferência de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
