/*
 * Base responsive compartida de GestPro.
 * Mantiene los diseños actuales y aporta reglas seguras comunes.
 */

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

img,
picture,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  max-width: 100%;
  height: auto;
}

.gestpro-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.gestpro-field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

@media (max-width: 768px), (pointer: coarse) {
  button,
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,
  textarea {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}

/* GestPro mobile navigation and POS layout v1 */
.gestpro-mobile-menu-button {
  display: none;
}

@media (max-width: 768px) {
  body.gestpro-has-mobile-sidebar {
    display: block !important;
    min-height: 100dvh;
  }

  body.gestpro-has-mobile-sidebar .gestpro-mobile-menu-button {
    position: sticky;
    top: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    padding: 10px 16px;
    border: 0;
    border-bottom: 1px solid #374151;
    border-radius: 0;
    background: #111827;
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
  }

  body.gestpro-has-mobile-sidebar .gestpro-mobile-menu-button:focus-visible {
    outline: 3px solid #a5b4fc;
    outline-offset: -3px;
  }

  body.gestpro-has-mobile-sidebar .gestpro-mobile-sidebar {
    display: none !important;
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 52px);
    margin: 0 !important;
    padding: 16px !important;
    overflow-y: auto;
    box-sizing: border-box;
  }

  body.gestpro-has-mobile-sidebar
    .gestpro-mobile-sidebar.gestpro-mobile-open {
    display: flex !important;
    flex-direction: column;
  }

  body.gestpro-has-mobile-sidebar > main,
  body.gestpro-has-mobile-sidebar .content,
  body.gestpro-has-mobile-sidebar .main-content {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    box-sizing: border-box;
  }

  body.gestpro-pos-page {
    height: auto !important;
    min-height: 100dvh;
  }

  body.gestpro-pos-page .navbar {
    gap: 10px;
    padding: 12px;
    flex-wrap: wrap;
  }

  body.gestpro-pos-page .navbar h1 {
    flex: 1 1 180px;
    font-size: 1.05rem;
    line-height: 1.25;
  }

  body.gestpro-pos-page .btn-nav {
    flex: 0 1 auto;
    padding: 10px 12px;
    text-align: center;
  }

  body.gestpro-pos-page .caja-status {
    padding: 10px 12px;
  }

  body.gestpro-pos-page .pos-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    flex: none !important;
    overflow: visible !important;
  }

  body.gestpro-pos-page .carrito-section {
    order: 1;
    width: 100%;
    min-width: 0;
    border-left: 0;
    border-bottom: 2px solid #e5e7eb;
  }

  body.gestpro-pos-page .catalogo-section {
    order: 2;
    min-width: 0;
    padding: 12px;
    overflow: visible !important;
  }

  body.gestpro-pos-page .grid-productos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body.gestpro-pos-page .producto-card {
    min-width: 0;
    padding: 12px;
  }

  body.gestpro-pos-page .producto-card h3 {
    overflow-wrap: anywhere;
    font-size: 0.95rem;
  }

  body.gestpro-pos-page .producto-card .precio {
    font-size: 1.1rem;
  }

  body.gestpro-pos-page .carrito-header,
  body.gestpro-pos-page .cliente-box,
  body.gestpro-pos-page .carrito-items,
  body.gestpro-pos-page .carrito-footer {
    padding: 14px;
  }

  body.gestpro-pos-page .carrito-items {
    flex: 0 1 auto;
    max-height: 320px;
  }

  body.gestpro-pos-page .total-fila {
    font-size: 1.1rem;
  }
}

@media (max-width: 360px) {
  body.gestpro-pos-page .grid-productos {
    grid-template-columns: minmax(0, 1fr);
  }

  body.gestpro-pos-page .cliente-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}
