/* ==========================================================================
   JJQM.es - Estilos del Ecosistema Personal & Cuaderno
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colores base: Oscuro sobrio y elegante */
  --bg-body: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.72);
  --bg-card-hover: rgba(26, 36, 56, 0.85);
  --bg-input: rgba(15, 23, 42, 0.75);
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-card-hover: rgba(99, 102, 241, 0.35);

  /* Texto */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Acentos */
  --indigo-accent: #6366f1;
  --indigo-light: #818cf8;
  --teal-accent: #14b8a6;
  --amber-accent: #f59e0b;
  --emerald-accent: #10b981;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  --shadow-subtle: 0 4px 20px -4px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 12px 32px -8px rgba(99, 102, 241, 0.18);
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Fondo ambiental */
.bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
}

.glow-top {
  width: 600px;
  height: 600px;
  top: -200px;
  left: 25%;
  background: radial-gradient(circle, var(--indigo-accent), transparent 70%);
}

.glow-bottom {
  width: 500px;
  height: 500px;
  bottom: 0;
  right: 15%;
  background: radial-gradient(circle, #0284c7, transparent 70%);
}

.subtle-grid {
  position: absolute;
  inset: 0;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
}

/* Layout General */
.app-layout {
  position: relative;
  z-index: 1;
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Barra Superior */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 3rem;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-monogram {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--indigo-accent), #4338ca);
  color: white;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text .tld {
  color: var(--indigo-light);
}

/* Pestañas de Navegación */
.nav-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

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

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: var(--indigo-accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* Hero Introductorio */
.intro-hero {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 3rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
}

.pulsing-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald-accent);
  box-shadow: 0 0 8px var(--emerald-accent);
}

.main-heading {
  font-size: clamp(2.2rem, 4.5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.gradient-text {
  background: linear-gradient(135deg, #a5b4fc 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro-description {
  font-size: 1.08rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Buscador Global */
.global-search-container {
  max-width: 520px;
  margin: 0 auto;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  padding: 0.8rem 2.8rem 0.8rem 2.9rem;
  border-radius: var(--radius-pill);
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  backdrop-filter: blur(12px);
  transition: var(--transition);
}

.search-input-wrapper input:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: rgba(22, 32, 52, 0.9);
}

.btn-clear {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}

/* Vistas */
.content-view {
  flex: 1;
}

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
  gap: 1rem;
  flex-wrap: wrap;
}

.view-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.view-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.view-meta {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Filtros de Categorías */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.filter-pill.active {
  background: var(--indigo-accent);
  color: #ffffff;
  border-color: var(--indigo-accent);
}

/* Grid de Proyectos */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-subtle);
  transition: var(--transition);
  position: relative;
  backdrop-filter: blur(12px);
}

.project-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  border-color: var(--border-card-hover);
  box-shadow: var(--shadow-hover);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.badge-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-status.production {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-status.dev {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-status.concept {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.subdomain-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--indigo-light);
  background: rgba(99, 102, 241, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.project-heading {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.project-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.tag-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  padding: 2px 8px;
  border-radius: 4px;
}

.card-action {
  margin-top: auto;
}

.btn-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-open:hover {
  background: var(--indigo-accent);
  border-color: var(--indigo-accent);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-open.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.btn-open svg {
  width: 15px;
  height: 15px;
}

/* Vista Cuaderno & Genealogía */
.notes-stream {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.note-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: var(--transition);
  cursor: pointer;
}

.note-item:hover {
  border-color: var(--border-card-hover);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.note-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.note-topic {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.note-topic.genealogia {
  background: rgba(20, 184, 166, 0.12);
  color: #2dd4bf;
  border: 1px solid rgba(20, 184, 166, 0.25);
}

.note-topic.tecnologia {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.note-date {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.note-title {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.note-excerpt {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.note-footer-action {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--indigo-light);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Vista Sobre el espacio */
.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 2.25rem;
  max-width: 820px;
  margin: 0 auto;
}

.about-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.about-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--indigo-accent), #4338ca);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: white;
}

.about-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.about-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.about-body p {
  color: var(--text-muted);
  font-size: 0.98rem;
  margin-bottom: 1.25rem;
}

.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.about-list li {
  position: relative;
  padding-left: 1.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.about-list li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--indigo-light);
  font-weight: bold;
}

.about-list strong {
  color: var(--text-main);
}

/* Estado Vacío */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
}

.empty-icon {
  font-size: 2.8rem;
  margin-bottom: 1rem;
}

.btn-restore {
  margin-top: 1rem;
  background: var(--indigo-accent);
  color: white;
  border: none;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

/* Modal de Lectura */
.note-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.note-modal-window {
  background: #111827;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

/* Footer */
.app-footer {
  margin-top: auto;
  padding-top: 3rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.footer-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 640px) {
  .top-nav {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-tabs {
    justify-content: center;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
}
