/**
 * workshop-modals.css
 * Estilos para los modales de Plantillas Temáticas y Exportación PDF de Taller (Fase 2).
 * Compatible con Desktop y Mobile Responsive.
 */

/* ==========================================================================
   1. MODAL DE PLANTILLAS TEMÁTICAS
   ========================================================================== */
.templates-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100030;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.templates-modal-overlay.active {
  display: flex !important;
}

.templates-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.templates-modal-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: tplModalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tplModalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.templates-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.templates-modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
}

.templates-modal-subtitle {
  margin: 0.15rem 0 0 0;
  font-size: 0.8rem;
  color: #64748b;
}

.templates-modal-close {
  background: #f1f5f9;
  border: none;
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.templates-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Pills de categorías */
.templates-categories-bar {
  padding: 0.75rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.tpl-cat-pill {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 9999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}

.tpl-cat-pill:hover {
  border-color: #8b5cf6;
  color: #8b5cf6;
}

.tpl-cat-pill.active {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

/* Grid de plantillas */
.templates-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
}

.tpl-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tpl-card:hover {
  border-color: #8b5cf6;
  box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.15);
  transform: translateY(-2px);
}

.tpl-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.tpl-emoji {
  font-size: 2rem;
  line-height: 1;
}

.tpl-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  background: #ede9fe;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tpl-card-body {
  flex: 1;
  margin-bottom: 1rem;
}

.tpl-title {
  margin: 0 0 0.35rem 0;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

.tpl-desc {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.4;
}

.tpl-card-footer {
  margin-top: auto;
}

.btn-use-template {
  width: 100%;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-use-template:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}

/* ==========================================================================
   2. MODAL DE EXPORTACIÓN PDF DE TALLER
   ========================================================================== */
.workshop-pdf-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100030;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.workshop-pdf-modal-overlay.active {
  display: flex !important;
}

.workshop-pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.workshop-pdf-modal-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: tplModalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.workshop-pdf-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workshop-pdf-body {
  padding: 1.5rem;
}

.workshop-pdf-options-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.workshop-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.workshop-radio-card:hover {
  border-color: #8b5cf6;
  background: #faf5ff;
}

.workshop-radio-card input[type="radio"] {
  margin-top: 0.2rem;
  accent-color: #8b5cf6;
  width: 17px;
  height: 17px;
}

.workshop-radio-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.workshop-radio-desc {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.workshop-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border-radius: 12px;
  margin-top: 0.75rem;
}

.workshop-toggle-info {
  display: flex;
  flex-direction: column;
}

.workshop-toggle-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.workshop-toggle-sub {
  font-size: 0.72rem;
  color: #64748b;
}

.workshop-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.workshop-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.25s;
  border-radius: 34px;
}

.workshop-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.workshop-switch input:checked + .workshop-slider {
  background-color: #8b5cf6;
}

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

.workshop-pdf-footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  gap: 0.75rem;
}

.spinner-inline {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsividad para móviles */
@media (max-width: 640px) {
  .templates-modal-container {
    max-height: 95vh;
    border-radius: 16px;
  }
  .templates-grid {
    grid-template-columns: 1fr;
  }
}
