/**
 * Estilos del Constructor de Firmas de Correo
 * Fijate Tools - Generador de firmas de correo HTML
 */

.app-main {
  max-width: 1720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: minmax(460px, 580px) 1fr;
  gap: 1.5rem;
  flex: 1;
  align-items: start;
}

/* Paneles */
.panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.02);
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
}

.panel-title svg {
  color: var(--accent-primary);
}

.panel-body {
  padding: 1.25rem;
  overflow-y: auto;
}

/* Panel Izquierdo: Pestañas de Edición */
.editor-panel {
  max-height: calc(100vh - var(--header-height) - 3rem);
}

.editor-tabs-nav {
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  background-color: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}

.editor-tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.tab-btn.active {
  color: #ffffff;
  background-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.tab-content {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Selector de Plantillas Visuales */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.template-card {
  background-color: var(--bg-input);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  position: relative;
}

.template-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.template-card.active {
  border-color: var(--accent-primary);
  background-color: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.template-badge-active {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  background-color: var(--accent-primary);
  color: #ffffff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.template-card.active .template-badge-active {
  display: flex;
}

.template-icon-preview {
  width: 100%;
  height: 48px;
  background-color: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.template-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Secciones y Acordeones */
.section-box {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
}

.section-box-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Gestión de Imágenes / Logo / Avatar */
.image-upload-wrap {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.image-preview-box {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--bg-input);
  flex-shrink: 0;
  position: relative;
}

.image-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-placeholder {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 4px;
}

.image-inputs-flex {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shape-radios {
  display: flex;
  gap: 0.5rem;
}

.shape-btn {
  flex: 1;
  padding: 0.4rem;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-input);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.shape-btn.active {
  border-color: var(--accent-primary);
  background-color: rgba(59, 130, 246, 0.15);
  color: #ffffff;
}

/* Redes Sociales List */
.social-item {
  display: grid;
  grid-template-columns: 28px 100px 1fr 34px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  transition: border-color 0.2s;
}

.social-item:focus-within {
  border-color: var(--border-focus);
}

.social-item-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-item-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-surface-hover);
  transition: 0.2s;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(14px);
}

/* Paletas y Selectores de Color */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.color-swatch-input {
  -webkit-appearance: none;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.color-swatch-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-swatch-input::-webkit-color-swatch {
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
}

.quick-palettes {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.palette-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.palette-chip:hover {
  transform: scale(1.18);
  border-color: #ffffff;
}

/* Panel Derecho: Previsualización */
.preview-panel {
  position: sticky;
  top: calc(var(--header-height) + 1.25rem);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background-color: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.preview-toggles-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-toggle-view {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-toggle-view.active {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Simulador de Cliente de Correo */
.email-client-mockup {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: max-width 0.3s ease, background-color 0.2s ease;
  margin: 0 auto;
  width: 100%;
}

.mockup-header {
  background-color: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #475569;
}

.mockup-header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mockup-header-label {
  font-weight: 600;
  color: #64748b;
  width: 45px;
}

.mockup-body {
  padding: 1.5rem;
  min-height: 220px;
  overflow-x: auto;
  transition: background-color 0.2s ease;
}

.mockup-dummy-text {
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed #cbd5e1;
}

/* Modos de Fondo de Prueba */
.email-client-mockup[data-preview-bg="white"] {
  background-color: #ffffff;
}

.email-client-mockup[data-preview-bg="gray"] {
  background-color: #f8fafc;
}

.email-client-mockup[data-preview-bg="dark"] {
  background-color: #1e293b;
}

.email-client-mockup[data-preview-bg="dark"] .mockup-header {
  background-color: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

.email-client-mockup[data-preview-bg="dark"] .mockup-header-label {
  color: #64748b;
}

.email-client-mockup[data-preview-bg="dark"] .mockup-dummy-text {
  color: #94a3b8;
  border-color: #334155;
}

/* Modo Móvil */
.email-client-mockup.mobile-view {
  max-width: 380px;
}

/* Barra de Acciones Principales y Métricas */
.actions-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.primary-cta-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.health-metrics-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
}

.health-metrics-badge.warning .health-dot {
  background-color: var(--accent-amber);
}

.health-metrics-badge.critical .health-dot {
  background-color: var(--accent-rose);
}

/* Responsive */
@media (max-width: 1180px) {
  .app-main {
    grid-template-columns: 1fr;
  }
  
  .editor-panel {
    max-height: none;
  }
  
  .preview-panel {
    position: static;
  }
}
