/* recetas.css - Configuración de Recetas v6.8.3 */

/* ============================================
   Toggle switches (sin Bootstrap JS)
   ============================================ */

.rx-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

.rx-toggle-row:last-child {
  border-bottom: none;
}

.rx-toggle-row--sub {
  padding-left: 24px;
  background: #f9fafb;
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: -1px;
}

.rx-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-left: 12px;
}

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

.rx-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d1d5db;
  transition: background-color 0.2s ease;
  border-radius: 24px;
}

.rx-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: transform 0.2s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.rx-switch input:checked + .rx-slider {
  background-color: #2563eb;
}

.rx-switch input:checked + .rx-slider::before {
  transform: translateX(20px);
}

.rx-switch input:focus + .rx-slider {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ============================================
   Title suggestions
   ============================================ */

.rx-title-suggestion {
  font-size: 0.8rem;
  text-decoration: none;
}

.rx-title-suggestion:hover {
  text-decoration: underline;
}

/* ============================================
   Stamp position selector (radio visual)
   ============================================ */

.rx-position-selector {
  display: flex;
  gap: 8px;
}

.rx-position-option {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.rx-position-option input {
  display: none;
}

.rx-position-option:hover {
  border-color: #93c5fd;
  color: #374151;
}

.rx-position-option.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

/* ============================================
   Preview: Mockup receta estilo documento
   ============================================ */

.rx-preview-page {
  background: #fff;
  border: none;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 30px 28px 0;
  font-size: 11px;
  color: #374151;
  line-height: 1.5;
  max-width: 440px;
  margin: 0 auto;
  min-height: 680px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Hidden state for preview elements */
.rx-preview-hidden {
  display: none !important;
}

/* Header */
.rx-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.rx-preview-header-left {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.rx-preview-logo {
  width: 36px;
  height: 36px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 16px;
  flex-shrink: 0;
}

.rx-preview-clinic-info {
  min-width: 0;
}

.rx-preview-clinic-name {
  font-weight: 700;
  font-size: 12px;
  color: #1e3a5f;
  margin-bottom: 1px;
}

.rx-preview-clinic-detail {
  font-size: 8.5px;
  color: #6b7280;
  line-height: 1.3;
}

.rx-preview-date {
  font-size: 9px;
  color: #6b7280;
  white-space: nowrap;
}

/* Separators — documento: líneas oscuras prominentes */
.rx-preview-hr {
  border: none;
  border-top: 2px solid #1a1a1a;
  margin: 6px 0;
}

/* Separador antes del Rp (después de datos paciente) */
.rx-preview-hr--body {
  border-top-width: 1.5px;
}

/* Footer: línea sutil gris, distinta del documento */
.rx-preview-hr--footer {
  border-top: 0.5px solid #d1d5db;
  margin-top: 0;
  margin-bottom: 4px;
}

/* Title */
.rx-preview-title {
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: #1e3a5f;
  margin-bottom: 2px;
}

.rx-preview-rx-number {
  text-align: center;
  font-size: 9px;
  color: #9ca3af;
  margin-bottom: 6px;
}

/* Info box — limpio, sin bordes entre filas */
.rx-preview-info-box {
  background: none;
  border: none;
  padding: 4px 0;
  margin-bottom: 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.rx-preview-info-row {
  font-size: 10px;
  line-height: 1.4;
  padding: 1px 0;
  border: none;
}

.rx-label {
  font-weight: 600;
}

/* Fila flex: 2 items distribuidos */
.rx-row-flex {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  box-sizing: border-box;
}

.rx-row-flex > span {
  white-space: nowrap;
  max-width: 60%;
}

.rx-row-flex > span:last-child {
  max-width: 35%;
  text-align: right;
}

/* Fila 3 columnas distribuidas */
.rx-row-3col {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.rx-col-25 {
  white-space: nowrap;
}

.rx-col-50 {
  flex: 1;
}

/* Rp */
.rx-preview-rp {
  font-weight: 700;
  font-size: 14px;
  font-style: italic;
  color: #1e3a5f;
  margin-top: 4px;
  margin-bottom: 4px;
}

.rx-preview-med {
  padding-left: 12px;
  margin-bottom: 8px;
}

.rx-preview-med-name {
  font-weight: 600;
  font-size: 10.5px;
  color: #374151;
}

.rx-preview-med-detail {
  font-size: 9px;
  color: #6b7280;
}

/* ============================================
   Signature block — layout por posición timbre
   ============================================ */

.rx-preview-signature-block {
  text-align: center;
  margin-top: 48px;
  margin-bottom: 12px;
}

/* Sig core (firma + datos) */
.rx-preview-sig-core {
  display: inline-block;
  text-align: center;
}

.rx-preview-sig-line {
  width: 160px;
  height: 1.5px;
  background: #1a1a1a;
  margin: 0 auto 4px;
}

.rx-preview-sig-name {
  font-weight: 700;
  font-size: 10px;
  color: #374151;
}

.rx-preview-sig-detail {
  font-size: 8.5px;
  color: #6b7280;
}

/* Stamp placeholder */
.rx-preview-stamp {
  margin-top: 8px;
}

.rx-preview-stamp-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 4px;
  color: #9ca3af;
  font-size: 9px;
}

/* Position: below (default) — vertical stack centered */
.rx-preview-signature-block[data-stamp-position="below"] {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Position: left — stamp on left, firma on right */
.rx-preview-signature-block[data-stamp-position="left"] {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin-top: 56px;
  flex-wrap: wrap;
}

.rx-preview-signature-block[data-stamp-position="left"] .rx-preview-stamp {
  margin-top: 0;
}

.rx-preview-signature-block[data-stamp-position="left"] .rx-preview-sig-line {
  width: 120px;
}

/* Position: right — firma on left, stamp on right */
.rx-preview-signature-block[data-stamp-position="right"] {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin-top: 56px;
  flex-wrap: wrap;
}

.rx-preview-signature-block[data-stamp-position="right"] .rx-preview-stamp {
  margin-top: 0;
}

.rx-preview-signature-block[data-stamp-position="right"] .rx-preview-sig-line {
  width: 120px;
}

/* Stamp lateral: placeholder más compacto */
.rx-preview-signature-block[data-stamp-position="left"] .rx-preview-stamp-placeholder,
.rx-preview-signature-block[data-stamp-position="right"] .rx-preview-stamp-placeholder {
  padding: 4px 8px;
  font-size: 7px;
  gap: 3px;
}

/* ============================================
   Disclaimer & footer
   ============================================ */

.rx-preview-disclaimer {
  text-align: center;
  font-size: 8px;
  color: #9ca3af;
  font-weight: 600;
  line-height: 1.4;
  margin: 8px 0;
}

.rx-preview-additional-footer {
  text-align: center;
  font-size: 8px;
  color: #9ca3af;
  line-height: 1.4;
  margin-bottom: 4px;
}

/* Footer fijo al fondo del mockup */
.rx-preview-footer-fixed {
  margin-top: auto;
  padding-bottom: 16px;
}

.rx-preview-branding {
  display: flex;
  justify-content: space-between;
  font-size: 7.5px;
  color: #d1d5db;
}

/* ============================================
   Responsive: mobile stack
   ============================================ */

@media (max-width: 991.98px) {
  .rx-preview-page {
    max-width: 100%;
    margin-top: 16px;
  }

  .rx-position-selector {
    flex-wrap: wrap;
  }
}
