/* ============================================================
   GBoX WordPress Plugin — gbox-builder.css
   Layout visual estilizado y profesional (PC, Tablet y Móvil)
   ============================================================ */

.gbox-builder-app {
  display: flex;
  flex-direction: column;
  background: var(--gbox-bg);
  border-radius: var(--gbox-r-lg);
  border: 1px solid var(--gbox-border);
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,0.06);
  width: 100%;
}

/* Header */
.gbox-header {
  background: var(--gbox-surface);
  border-bottom: 1px solid var(--gbox-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.gbox-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  color: var(--gbox-gold-dark);
  letter-spacing: -0.02em;
}

/* Type Toggle */
.gbox-type-toggle {
  display: flex;
  background: var(--gbox-surface-3);
  border-radius: var(--gbox-r-lg);
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--gbox-border-light);
}

.gbox-type-btn {
  padding: 7px 16px;
  border-radius: 9px;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: var(--gbox-text-muted);
  transition: all 0.2s ease;
}

.gbox-type-btn.is-active.normal {
  background: #E8D9C4;
  color: var(--gbox-brown);
  box-shadow: 0 2px 8px rgba(107,76,30,0.12);
}

.gbox-type-btn.is-active.vip {
  background: var(--gbox-vip-bg);
  color: var(--gbox-vip-accent);
  box-shadow: 0 4px 12px rgba(201,168,76,0.35);
  border: 1px solid rgba(201,168,76,0.3);
}

/* Total in Header */
.gbox-total-wrap { text-align: right; }
.gbox-total-label { font-size: 10px; font-weight: 700; color: var(--gbox-text-light); text-transform: uppercase; letter-spacing: 0.05em; }
.gbox-total-amount { font-size: 20px; font-weight: 800; color: var(--gbox-text); letter-spacing: -0.02em; }

/* Steps Tabs */
.gbox-steps {
  background: var(--gbox-surface);
  border-bottom: 1px solid var(--gbox-border);
  display: flex;
  align-items: stretch;
  padding: 0 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.gbox-step-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-bottom: 3px solid transparent;
  color: var(--gbox-text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.gbox-step-btn:hover { color: var(--gbox-text); background: var(--gbox-surface-2); }
.gbox-step-btn.is-active { color: var(--gbox-gold-dark); border-bottom-color: var(--gbox-gold); background: var(--gbox-surface-2); }
.gbox-step-count {
  min-width: 20px; height: 20px; border-radius: var(--gbox-r-full);
  background: var(--gbox-surface-3); color: var(--gbox-text-muted);
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.gbox-step-count.has-items { background: var(--gbox-gold); color: #FFF; box-shadow: 0 2px 6px rgba(201,151,59,0.3); }
.gbox-step-arrow { color: var(--gbox-border); display: flex; align-items: center; padding: 0 2px; }

/* Workspace (Expansive Central Area) */
.gbox-workspace {
  padding: 26px 20px 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.gbox-info-bar {
  width: 100%;
  max-width: 860px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gbox-surface);
  border-radius: var(--gbox-r-lg);
  padding: 12px 18px;
  border: 1px solid var(--gbox-border-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  flex-wrap: wrap;
  gap: 8px;
}

/* Explosion Cross Grid — Visual Folded Box Metaphor */
.gbox-cross {
  width: 100%;
  max-width: 860px;
  display: grid;
  grid-template-areas:
    ". north ."
    "west center east"
    ". south .";
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 12px;
  margin: 0 auto;
}

.gbox-cross-north  { grid-area: north; }
.gbox-cross-west   { grid-area: west; }
.gbox-cross-center { grid-area: center; }
.gbox-cross-east   { grid-area: east; }
.gbox-cross-south  { grid-area: south; }

.gbox-wall-panel {
  background: var(--gbox-surface);
  border-radius: var(--gbox-r-lg);
  padding: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
  border: 1.5px solid var(--gbox-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.gbox-wall-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gbox-text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--gbox-border-light);
}

.gbox-slots-row { display: flex; gap: 8px; }
.gbox-slots-row .gbox-slot-card { flex: 1; }
.gbox-slots-col { display: flex; flex-direction: column; gap: 8px; }

/* Center Stage Box */
.gbox-center-inner {
  width: 100%; height: 100%; min-height: 150px;
  background: var(--gbox-surface-2);
  border: 2px dashed var(--gbox-border);
  border-radius: var(--gbox-r-lg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; text-align: center;
  padding: 10px;
  transition: all 0.2s ease;
}

/* Slot Card (Desktop) */
.gbox-slot-card {
  min-height: 85px;
  border: 2px dashed var(--gbox-border);
  border-radius: var(--gbox-r-md);
  background: var(--gbox-surface-2);
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; padding: 6px;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.gbox-slot-card:hover {
  border-color: var(--gbox-gold);
  background: var(--gbox-gold-light);
  transform: translateY(-2px);
}

.gbox-slot-add-icon { font-size: 20px; color: var(--gbox-text-light); font-weight: bold; transition: color 0.2s ease; }
.gbox-slot-card:hover .gbox-slot-add-icon { color: var(--gbox-gold-dark); }
.gbox-slot-add-label { font-size: 11px; color: var(--gbox-text-light); font-weight: 600; }

.gbox-slot-card.is-filled {
  border: 1.5px solid var(--gbox-border);
  background: var(--gbox-surface);
  padding: 0;
  cursor: default;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.gbox-slot-card.is-filled:hover { transform: none; }

.gbox-slot-product-img {
  width: 100%; height: 65px;
  object-fit: cover;
  border-radius: calc(var(--gbox-r-md) - 2px) calc(var(--gbox-r-md) - 2px) 0 0;
  display: block;
}

.gbox-slot-product-info { padding: 4px 6px 6px; width: 100%; text-align: center; }
.gbox-slot-product-name { font-size: 11px; font-weight: 700; color: var(--gbox-text); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gbox-slot-product-price { font-size: 11px; font-weight: 800; color: var(--gbox-gold-dark); margin-top: 2px; }

.gbox-slot-remove-btn {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(220,38,38,0.9); border: none;
  color: #FFF; font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.85; transition: all 0.2s ease;
  z-index: 5;
}
.gbox-slot-remove-btn:hover { opacity: 1; transform: scale(1.1); background: #DC2626; }

/* Fixed Bottom Summary Bar */
.gbox-bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--gbox-surface);
  border-top: 1px solid var(--gbox-border);
  padding: 12px 22px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  z-index: 9998;
  flex-wrap: wrap;
  gap: 10px;
}

/* VIP Theme adjustments */
.gbox-wrapper.mode-vip .gbox-header { background: var(--gbox-vip-bg); border-color: #2D2738; }
.gbox-wrapper.mode-vip .gbox-brand { color: var(--gbox-vip-accent); }
.gbox-wrapper.mode-vip .gbox-total-amount { color: var(--gbox-vip-accent); }
.gbox-wrapper.mode-vip .gbox-step-btn.is-active { color: var(--gbox-vip-accent); border-bottom-color: var(--gbox-vip-accent); }
.gbox-wrapper.mode-vip .gbox-bottom-bar { background: var(--gbox-vip-bg); border-color: #2D2738; color: #FFF; }
.gbox-wrapper.mode-vip .gbox-bottom-bar strong { color: var(--gbox-vip-accent); }
.gbox-wrapper.mode-vip .gbox-wall-panel { border-color: rgba(201,168,76,0.25); background: #FAF7F2; }

/* Drawer Category & Product cards */
.gbox-cat-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 14px; }
.gbox-cat-chip {
  padding: 5px 12px; border-radius: var(--gbox-r-full);
  font-size: 11px; font-weight: 700; border: 1.5px solid var(--gbox-border);
  background: transparent; color: var(--gbox-text-muted); cursor: pointer;
  transition: all 0.2s ease;
}
.gbox-cat-chip:hover { border-color: var(--gbox-gold); color: var(--gbox-gold-dark); }
.gbox-cat-chip.is-active { background: var(--gbox-gold); color: #FFF; border-color: var(--gbox-gold); }

.gbox-prods-list { display: flex; flex-direction: column; gap: 8px; }
.gbox-prod-item {
  display: flex; gap: 12px; padding: 10px;
  border: 1.5px solid var(--gbox-border-light); border-radius: var(--gbox-r-md);
  background: var(--gbox-surface); cursor: pointer; transition: all 0.2s ease;
}
.gbox-prod-item:hover { border-color: var(--gbox-gold); box-shadow: 0 4px 12px rgba(0,0,0,0.06); transform: translateY(-1px); }
.gbox-prod-item-img { width: 54px; height: 54px; border-radius: var(--gbox-r-sm); object-fit: cover; background: var(--gbox-surface-3); flex-shrink: 0; }
.gbox-prod-item-name { font-size: 13px; font-weight: 700; color: var(--gbox-text); }
.gbox-prod-item-desc { font-size: 11px; color: var(--gbox-text-muted); margin-top: 2px; line-height: 1.3; }
.gbox-prod-item-price { font-size: 13px; font-weight: 800; color: var(--gbox-gold-dark); margin-top: 3px; }

/* ── TABLET OPTIMIZACIÓN (600px - 900px) ─────────────────────── */
@media (max-width: 900px) {
  .gbox-cross {
    max-width: 680px;
    gap: 8px;
  }
  .gbox-slot-card {
    min-height: 75px;
  }
  .gbox-slot-product-img {
    height: 52px;
  }
}

/* ── MÓVIL / CELULAR OPTIMIZACIÓN (< 680px) — 100% FLUIDO Y SIN DESBORDES ─── */
@media (max-width: 680px) {
  .gbox-builder-app {
    border-radius: 8px;
  }

  .gbox-header {
    padding: 10px 12px;
  }
  .gbox-brand { font-size: 16px; }
  .gbox-total-amount { font-size: 16px; }

  .gbox-type-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .gbox-steps {
    padding: 0 6px;
  }
  .gbox-step-btn {
    padding: 8px 10px;
    font-size: 11px;
  }

  .gbox-workspace {
    padding: 12px 6px 95px;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .gbox-info-bar {
    padding: 8px 12px;
    font-size: 11px;
    border-radius: var(--gbox-r-md);
  }

  /* En móvil las paredes se apilan verticalmente de forma ordenada y cómoda */
  .gbox-cross {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    gap: 10px;
    margin: 0;
  }

  .gbox-wall-panel {
    width: 100%;
    padding: 10px;
    gap: 8px;
    border-radius: var(--gbox-r-md);
    box-sizing: border-box;
  }

  .gbox-wall-label {
    font-size: 11px;
    font-weight: 800;
    padding-bottom: 4px;
    color: var(--gbox-text);
  }

  .gbox-slots-row, .gbox-slots-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    width: 100%;
  }

  .gbox-slot-card {
    min-height: 70px;
    padding: 4px;
    border-radius: var(--gbox-r-sm);
    width: 100%;
    box-sizing: border-box;
  }

  .gbox-slot-product-img {
    height: 50px;
  }

  .gbox-slot-product-name {
    font-size: 10px;
  }
  .gbox-slot-product-price {
    font-size: 10px;
  }
  .gbox-slot-add-icon {
    font-size: 16px;
  }
  .gbox-slot-add-label {
    font-size: 10px;
  }

  .gbox-center-inner {
    min-height: 100px;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .gbox-bottom-bar {
    padding: 10px 14px;
    font-size: 12px;
  }

  .gbox-bottom-bar .gbox-btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  .gbox-drawer {
    width: 100vw;
  }
}