/* ============================================================
   ZYRA CRM — Módulo Productos & Objeciones (Session 15)
   ============================================================ */

/* ── Toolbar ── */
.prod-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.prod-search-input {
  flex: 1;
  min-width: 200px;
  max-width: 340px;
  padding: .5rem .9rem;
  font-size: .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
}

/* ── Grid de tarjetas ── */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1024px) { .prod-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .prod-grid { grid-template-columns: 1fr; } }

/* ── Tarjeta ── */
.prod-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  padding: 1.1rem;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
  border: 1px solid transparent;
}

.prod-card:hover { box-shadow: 0 4px 20px rgba(74,26,107,.13); border-color: #e0d5ee; transform: translateY(-2px); }

.prod-card-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .75rem;
}

.prod-placeholder {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 12px;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.prod-img {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 12px;
  object-fit: cover;
}

.prod-card-info { flex: 1; min-width: 0; }

.prod-card-name {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prod-card-prices {
  display: flex;
  gap: .5rem;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .6rem;
}

.prod-card-badges {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.prod-card-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ── Toggle switch ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  transition: background .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  left: 3px;
  top: 3px;
  transition: transform .2s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  overflow-y: auto;
}

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
}

.modal-xl { max-width: 820px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-header h3 { font-size: 1.05rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0 .25rem;
}

.modal-close:hover { color: var(--text); }

/* ── Tabs ── */
.prod-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  gap: 0;
  overflow-x: auto;
  background: var(--surface);
  position: sticky;
  top: 62px;
  z-index: 1;
}

.prod-tab {
  background: none;
  border: none;
  padding: .75rem 1.1rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}

.prod-tab.active { color: var(--sidebar); border-bottom-color: var(--sidebar); }
.prod-tab:hover:not(.active) { color: var(--text); }

.prod-tab-content { padding: 1.5rem; }

/* ── Formularios en tabs ── */
.tab-form { display: flex; flex-direction: column; gap: .9rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

@media (max-width: 540px) { .field-row { grid-template-columns: 1fr; } }

/* ── Editor de precios ── */
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  margin-bottom: .5rem;
}

.pricing-table th {
  text-align: left;
  padding: .4rem .5rem;
  font-weight: 600;
  font-size: .8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.pricing-table td { padding: .35rem .4rem; border-bottom: 1px solid #f0f0f0; }

.pi {
  width: 100%;
  padding: .3rem .5rem;
  font-size: .85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-family: inherit;
}

.pi:focus { outline: none; border-color: var(--accent); }

/* ── Lista de scripts ── */
.scripts-list { display: flex; flex-direction: column; gap: .6rem; }

.script-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  background: var(--bg);
}

.script-item-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .35rem;
}

.script-etapa-badge {
  background: var(--sidebar);
  color: #fff;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: .75rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.script-titulo { font-weight: 600; font-size: .9rem; flex: 1; }

.script-preview {
  font-size: .82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Variables en editor de script ── */
.var-chips { display: flex; flex-direction: column; gap: .4rem; }

.var-chip {
  background: #F5F0FF;
  color: var(--sidebar);
  border: 1px solid #d8c5f0;
  border-radius: 6px;
  padding: .25rem .6rem;
  font-size: .78rem;
  font-family: monospace;
  cursor: pointer;
  user-select: none;
  word-break: break-all;
  transition: background .15s;
}

.var-chip:hover { background: #ede0ff; }

/* ── Botones extra ── */
.btn-sm {
  padding: .28rem .7rem;
  font-size: .82rem;
  border-radius: 6px;
}

.btn-danger {
  background: #fff0ee;
  color: var(--alert);
  border: 1px solid #f5c0b0;
}

.btn-danger:hover { background: #ffe0da; }

/* ── Tabla de objeciones ── */
.obj-table-wrap table { font-size: .88rem; }
