/**
 * PegasusOps — UX de campo (mobile-first)
 * Otimizado para operação no celular: alvos de toque grandes, sticky actions, tipografia legível.
 */

/* ——— Base mobile (todas as telas) ——— */
@media (max-width: 991.98px) {
  .content {
    padding: .85rem .75rem 5.5rem !important;
  }

  .ops-page-title {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  .ops-page-sub {
    font-size: .85rem;
  }

  .topbar {
    padding-left: .65rem !important;
    padding-right: .65rem !important;
    min-height: 52px;
  }

  .topbar-left .fw-semibold {
    font-size: .9rem;
  }

  .topbar-user-nome {
    max-width: 96px;
    font-size: .85rem;
  }

  .form-control,
  .form-select {
    min-height: 48px;
    font-size: 16px; /* evita zoom automático no iOS */
    border-radius: 10px;
  }

  textarea.form-control {
    min-height: 110px;
  }

  .btn:not(.btn-sm):not(.btn-link) {
    min-height: 48px;
    padding: .7rem 1rem;
    font-size: 1rem;
    border-radius: 10px;
  }

  .ops-card {
    border-radius: 12px;
  }

  .ops-card-body {
    padding: .9rem;
  }

  /* Menu lateral: alvo de toque maior */
  #sidebar.minimized .sidebar-minimizer {
    width: 28px;
    height: 72px;
  }
}

/* ——— Modo campo (páginas do inspetor) ——— */
body.ops-campo .ops-campo-hero {
  background: linear-gradient(135deg, var(--pegasus-menu-bg) 0%, var(--pegasus-menu-accent) 100%);
  color: #fff;
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
}

body.ops-campo .ops-campo-hero h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

body.ops-campo .ops-campo-hero p {
  margin: .35rem 0 0;
  font-size: .88rem;
  opacity: .92;
}

/* Cards de posto — área de toque ampla */
.ops-posto-card {
  border-radius: 14px;
  padding: 1.1rem;
  box-shadow: 0 2px 10px rgba(69, 112, 180, .07);
  transition: box-shadow .15s ease, transform .15s ease;
}

.ops-posto-card .ico {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 1.35rem;
}

.ops-posto-card .btn {
  min-height: 48px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
}

@media (max-width: 991.98px) {
  .ops-posto-card {
    padding: 1.15rem;
  }

  .ops-postos-lista .col-md-6,
  .ops-postos-lista .col-xl-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .ops-campo-filtros .row > [class*="col-"] {
    margin-bottom: .35rem;
  }
}

/* Checklist — botões Conforme / Não conforme full-width */
.ops-check-item {
  padding: 1rem 0;
}

.ops-touch-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  width: 100%;
}

.ops-touch-choice .btn {
  min-height: 52px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem .5rem;
}

.ops-touch-choice .btn-check:checked + .btn-outline-success {
  background-color: #198754;
  border-color: #198754;
  color: #fff;
}

.ops-touch-choice .btn-check:checked + .btn-outline-danger {
  background-color: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

@media (max-width: 575.98px) {
  .ops-touch-choice {
    grid-template-columns: 1fr;
  }

  .ops-touch-choice .btn {
    min-height: 56px;
    font-size: 1.05rem;
  }
}

/* Gravidade — chips grandes */
.ops-grav-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}

.ops-grav-choice .btn {
  min-height: 48px;
  font-weight: 600;
  border-radius: 10px;
}

.ops-grav-choice .btn-check:checked + label {
  color: #fff !important;
}

.ops-grav-choice .btn-check:checked + label[for="g_baixa"] { background: #198754; border-color: #198754; }
.ops-grav-choice .btn-check:checked + label[for="g_media"] { background: #E09600; border-color: #E09600; }
.ops-grav-choice .btn-check:checked + label[for="g_alta"] { background: #E65100; border-color: #E65100; }
.ops-grav-choice .btn-check:checked + label[for="g_critica"] { background: #C62828; border-color: #C62828; }

/* Barra de ações sticky (campo) */
.ops-mobile-actions {
  position: sticky;
  bottom: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--ops-border);
  padding: .75rem .15rem calc(.75rem + env(safe-area-inset-bottom, 0px));
  margin: 1.25rem -.15rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
}

.ops-mobile-actions .btn {
  min-height: 50px;
  margin: 0 !important;
  width: 100%;
  font-weight: 600;
  border-radius: 12px;
}

.ops-mobile-actions .btn-ops,
.ops-mobile-actions .ops-action-primary {
  grid-column: 1 / -1;
  min-height: 54px;
  font-size: 1.05rem;
}

@media (min-width: 768px) {
  .ops-mobile-actions {
    display: flex;
    flex-wrap: wrap;
    box-shadow: none;
    backdrop-filter: none;
  }

  .ops-mobile-actions .btn {
    width: auto;
  }

  .ops-mobile-actions .btn-ops,
  .ops-mobile-actions .ops-action-primary {
    grid-column: auto;
    margin-left: auto !important;
    width: auto;
  }
}

/* Assinatura */
.ops-sig-pad {
  height: 180px;
  border-radius: 12px;
  border-width: 2px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

@media (max-width: 991.98px) {
  .ops-sig-pad {
    height: 200px;
  }
}

/* Progresso mais visível */
body.ops-campo .ops-progress {
  height: 12px;
}

/* Link voltar — área de toque */
.ops-back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 44px;
  padding: .25rem 0;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
}

/* Input file amigável */
@media (max-width: 991.98px) {
  input[type="file"].form-control {
    padding: .85rem;
  }
}

/* Safe area iPhone */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 991.98px) {
    .footer {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}
