﻿/* ==========================================================================
   PEIDAGOGOS STEAM — SISTEMA DE DISEÑO Y ESTILOS PROFESIONALES (100% OFFLINE)
   Sin dependencias de CDNs externos. Funciona al 100% en file:/// y en web.
   ========================================================================== */

:root {
  --primary: #0f3d64;
  --primary-hover: #0a2944;
  --primary-light: #e8f2fa;
  --accent-green: #2fb36d;
  --accent-blue: #0ea5e9;
  --accent-orange: #f59e0b;
  --accent-pink: #ec4899;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f1f5f9;
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Reglas estrictas para SVG e Iconos */
svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* Contenedor central */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Encabezado Principal */
.main-header {
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.brand-info {
  border-left: 2px solid var(--slate-200);
  padding-left: 14px;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-version {
  background: #e0f2fe;
  color: #0369a1;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

/* Estado de la API */
.api-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.api-pill.connected {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}

.api-pill.disconnected {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.connected .pulse-dot { background: #22c55e; }
.disconnected .pulse-dot { background: #f59e0b; }

/* Barra de Pestañas de Navegación */
.nav-bar {
  background: var(--white);
  border-top: 1px solid var(--slate-100);
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-600);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-tab:hover {
  color: var(--primary);
  background: var(--slate-50);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #f8fafc;
}

.nav-tab svg {
  width: 18px;
  height: 18px;
}

/* Layout del contenido */
.main-content {
  padding: 32px 0 60px 0;
  flex: 1;
}

.tab-panel {
  display: block;
}

.tab-panel.hidden {
  display: none !important;
}

/* Tarjetas Principales */
.card-panel {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  padding: 32px;
  margin-bottom: 24px;
}

.panel-header {
  margin-bottom: 24px;
}

.step-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.panel-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.4px;
}

.panel-desc {
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 4px;
}

/* Formularios y Campos */
.form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.form-full {
  grid-column: 1 / -1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-700);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-900);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.btn-suggest {
  font-size: 11px;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-suggest:hover {
  background: #bae6fd;
}

.btn-suggest svg {
  width: 14px;
  height: 14px;
}

/* Selector de las 22 Actividades */
.activities-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
  margin-top: 16px;
}

.activity-card {
  background: var(--white);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
}

.activity-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.activity-card.selected {
  border-color: var(--primary);
  background: #f0f7ff;
  box-shadow: 0 0 0 2px var(--primary);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--slate-100);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-card.selected .card-icon {
  background: var(--primary);
  color: var(--white);
}

.card-icon svg {
  width: 20px;
  height: 20px;
}

.card-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--slate-400);
}

.card-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.25;
  margin-bottom: 4px;
}

.card-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  margin-top: auto;
}

/* Resumen de actividad seleccionada */
.selected-summary-box {
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.selected-summary-box .card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
}

.selected-summary-box .card-icon svg {
  width: 26px;
  height: 26px;
}

/* Botón Generador */
.btn-generate {
  width: 100%;
  padding: 18px 28px;
  font-size: 16px;
  font-weight: 800;
  color: var(--white);
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  box-shadow: 0 10px 20px -5px rgba(15, 61, 100, 0.4);
  transition: all 0.2s ease;
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px -5px rgba(15, 61, 100, 0.5);
}

.btn-generate:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-generate svg {
  width: 22px;
  height: 22px;
}

/* Barra de progreso de generación */
.progress-container {
  margin-top: 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #dcfce7;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 10px;
  transition: width 0.3s ease;
}

/* Simulador y Marco de Celular */
.preview-panel {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-top: 32px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--slate-200);
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.view-toggle {
  display: inline-flex;
  background: var(--slate-100);
  border-radius: var(--radius-md);
  padding: 3px;
  border: 1px solid var(--slate-200);
}

.view-toggle-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-700);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.view-toggle-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-action {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-700);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-action:hover {
  background: var(--slate-50);
  border-color: var(--slate-300);
}

.btn-action.btn-download {
  background: var(--accent-green);
  color: var(--white);
  border-color: var(--accent-green);
}

.btn-action.btn-download:hover {
  background: #279b5d;
}

.simulator-stage {
  margin-top: 24px;
  background: #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Marco iPhone */
.phone-mockup-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}

.phone-mockup {
  width: 390px;
  height: 720px;
  max-height: 80vh;
  border: 12px solid #1e293b;
  border-radius: 44px;
  background: var(--white);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  position: relative;
}

.desktop-view-wrapper {
  width: 100%;
}

.desktop-view {
  width: 100%;
  height: 720px;
  max-height: 80vh;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-md);
}

/* Catálogo detallado */
.catalog-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.cat-pill {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 30px;
  border: 1.5px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-700);
  cursor: pointer;
  transition: all 0.2s;
}

.cat-pill:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.cat-pill.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.catalog-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Modales */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 760px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  background: var(--slate-900);
  color: var(--white);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  background: var(--slate-50);
}

.modal-footer {
  padding: 16px 24px;
  background: var(--white);
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Pie de página */
.main-footer {
  background: var(--white);
  border-top: 1px solid var(--slate-200);
  padding: 24px 0;
  font-size: 12px;
  color: var(--slate-500);
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  color: var(--white);
  transition: all 0.3s ease;
}

.toast.toast-success { background: #15803d; }
.toast.toast-error { background: #b91c1c; }
.toast.toast-warning { background: #b45309; }
.toast.toast-info { background: #0f172a; }

/* Responsive móvil */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .header-inner {
    height: auto;
    padding: 12px 0;
    flex-direction: column;
    gap: 12px;
  }
  .brand-info {
    border-left: none;
    padding-left: 0;
  }
  .card-panel {
    padding: 20px;
  }
  .simulator-stage {
    padding: 12px;
  }
  .phone-mockup {
    width: 100%;
    border-width: 8px;
  }
}
