/* ============================================================================
   RIBBON GRAPH THEORY - RESEARCH PROJECT STYLES
   Custom CSS for professional academic presentation
   ============================================================================ */

/* --------------------------------------------------------------------------
   OCULTAR METADATA DEL AUTOR/FECHA EN PÁGINAS
   -------------------------------------------------------------------------- */
.quarto-title-meta {
  display: none;
}

/* --------------------------------------------------------------------------
   COLOR PALETTE & ROOT VARIABLES
   -------------------------------------------------------------------------- */
:root {
  /* Primary Brand Colors */
  --ribbon-primary: #1e88e5;
  --ribbon-primary-dark: #1565c0;
  --ribbon-primary-light: #42a5f5;

  /* Accent Colors */
  --ribbon-accent: #ff6f00;
  --ribbon-accent-light: #ffa726;

  /* Success & Highlights */
  --ribbon-success: #10b981;
  --ribbon-warning: #f59e0b;
  --ribbon-danger: #ef4444;

  /* Neutrals */
  --ribbon-dark: #1e293b;
  --ribbon-gray: #64748b;
  --ribbon-light-gray: #e2e8f0;
  --ribbon-bg: #f8fafc;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
  --gradient-hero: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Typography */
  --font-sans: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', 'Monaco', 'Courier New', monospace;

  /* Spacing */
  --spacing-unit: 0.25rem;
}

/* --------------------------------------------------------------------------
   LAYOUT - ANCHO OPTIMIZADO Y MEJOR APROVECHAMIENTO DEL ESPACIO
   -------------------------------------------------------------------------- */
/* Contenedor principal más ancho */
.quarto-container {
  max-width: 1900px !important;
  width: 98% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Contenido principal con mejor espaciado */
#quarto-content, main, article {
  max-width: 100% !important;
}

/* --------------------------------------------------------------------------
   GLOBAL STYLES
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font-sans);
  color: var(--ribbon-dark);
  font-size: 24px !important;  /* Forzado: Bootstrap pone .9rem que reduce el texto */
  line-height: 1.7;
  letter-spacing: 0.01em;
}

/* Paragraphs */
p {
  font-size: 1.05em;  /* Ligeramente más grande que el texto base */
  margin-bottom: 1em;
}

/* Lists - mismo tamaño que el texto base */
ul, ol {
  font-size: 1.05em !important;
  line-height: 1.7;
}

li {
  font-size: 1em !important;
  margin-bottom: 0.5em;
}

/* Menús - Tamaño de fuente aumentado para mejor legibilidad */
.navbar,
.navbar-nav,
.navbar-brand,
.navbar .navbar-nav .nav-link {
  font-size: 0.92em;  /* ~22px - tamaño moderado para navegación */
}

.sidebar-navigation,
.sidebar-navigation .sidebar-item,
.sidebar-navigation a {
  font-size: 0.92em;  /* ~22px - tamaño moderado para navegación */
  line-height: 1.8;  /* Mayor espaciado entre líneas para mejor legibilidad */
}

/* TOC con tamaño moderado - no tan grande como el texto principal */
#TOC,
#TOC .nav-link,
#TOC a {
  font-size: 0.83em !important;  /* ~20px - más pequeño que el texto principal */
  line-height: 1.7;  /* Espaciado cómodo entre líneas */
}

/* Selection */
::selection {
  background-color: var(--ribbon-primary-light);
  color: white;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
  font-size: 24px !important;  /* Root font-size: forzado sobre Bootstrap */
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  color: var(--ribbon-dark);
  border-bottom: 4px solid transparent;
  border-image: var(--gradient-primary) 1;
  padding-bottom: 0.75rem;
  margin-top: 3rem;
  position: relative;
}

h1::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 60px;
  height: 4px;
  background: var(--gradient-accent);
  border-radius: 2px;
}

h2 {
  font-size: 2rem;
  color: var(--ribbon-dark);
  border-left: 5px solid var(--ribbon-primary);
  padding-left: 1.25rem;
  margin-left: -1.5rem;
  transition: all 0.3s ease;
}

h2:hover {
  border-left-color: var(--ribbon-accent);
  transform: translateX(5px);
}

h3 {
  font-size: 1.5rem;
  color: var(--ribbon-primary-dark);
}

h4 {
  font-size: 1.25rem;
  color: var(--ribbon-gray);
}

/* Lead Text */
.lead {
  font-size: 1.25rem;
  font-weight: 300;
  line-height: 1.8;
  color: var(--ribbon-gray);
}

/* --------------------------------------------------------------------------
   MATH DISPLAY (Remove side highlights/backgrounds)
   -------------------------------------------------------------------------- */
.math.display,
div.math.display,
.katex-display,
.MathJax_Display,
mjx-container[display="true"],
.MathJax,
span.math.display {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-left: none !important;
  border-right: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* --------------------------------------------------------------------------
   HERO SECTION (For index page)
   -------------------------------------------------------------------------- */
.hero {
  background: var(--gradient-hero);
  color: white;
  padding: 2.75rem 2rem;
  border-radius: 1rem;
  margin: 1.5rem 0;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.hero h1 {
  color: white;
  border: none;
  font-size: 2.6rem;
  margin-top: 0;
}

.hero h1::before {
  display: none;
}

.hero h3 {
  color: #e3f2fd;
  font-weight: 400;
  font-style: italic;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.hero p {
  font-size: 1.1rem;
  margin-top: 0.75rem;
  color: #f8fafc;
  opacity: 0.95;
}

/* --------------------------------------------------------------------------
   AUTHOR LINE (Index page)
   -------------------------------------------------------------------------- */
.page-author {
  color: var(--ribbon-gray);
  font-size: 1rem;
  margin-top: 0.25rem;
  margin-bottom: 1.25rem;
  text-align: left;
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   CALLOUTS
   -------------------------------------------------------------------------- */
.callout {
  border-left-width: 5px;
  border-radius: 0.5rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: white;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  animation: slideInLeft 0.5s ease-out;
  font-size: 24px !important;
}

.callout:hover {
  box-shadow: var(--shadow-lg);
  transform: translateX(3px);
}

/* Asegurar que el contenido de los callouts tenga buen tamaño */
.callout p,
.callout li,
.callout div {
  font-size: 24px !important;
}

.callout ul,
.callout ol {
  font-size: 24px !important;
}

.callout .callout-title {
  font-size: 26px !important;
  font-weight: 700;
}

.callout-note {
  border-left-color: var(--ribbon-primary);
  background: linear-gradient(to right, rgba(30, 136, 229, 0.05), white);
}

.callout-tip {
  border-left-color: var(--ribbon-success);
  background: linear-gradient(to right, rgba(16, 185, 129, 0.05), white);
}

.callout-important {
  border-left-color: var(--ribbon-accent);
  background: linear-gradient(to right, rgba(255, 111, 0, 0.05), white);
}

/* Custom icon for important callouts (theorems) - using a more mathematical/academic icon */
.callout-important .callout-icon::before {
  content: "∎";  /* Q.E.D. symbol for theorems */
  font-size: 1.3em;
}

.callout-warning {
  border-left-color: var(--ribbon-warning);
  background: linear-gradient(to right, rgba(245, 158, 11, 0.05), white);
}

.callout-caution {
  border-left-color: var(--ribbon-danger);
  background: linear-gradient(to right, rgba(239, 68, 68, 0.05), white);
}

.callout-title {
  font-weight: 700;
  font-size: 1.1em;
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   CODE BLOCKS
   -------------------------------------------------------------------------- */
pre {
  border-left: 4px solid var(--ribbon-primary);
  padding: 1.5rem;
  border-radius: 0.5rem;
  background: linear-gradient(to right, rgba(30, 136, 229, 0.03), #f8fafc);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
}

pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px 0 0 4px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-weight: 500;
  letter-spacing: 0;
}

/* Inline Code */
p code, li code {
  background: rgba(30, 136, 229, 0.1);
  color: var(--ribbon-primary-dark);
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.9em;
  font-weight: 600;
}

/* Code Copy Button */
.code-copy-button {
  background: var(--ribbon-primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.code-copy-button:hover {
  background: var(--ribbon-primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Ocultar botón de copiar cuando el bloque de código está oculto
   (evita iconos sueltos en celdas OJS con echo: false) */
.code-copy-outer-scaffold > .sourceCode.cell-code.hidden + .code-copy-button {
  display: none !important;
}

/* Controles OJS: tamaño legible y consistente (no heredado gigante del body) */
[id^="ojs-cell-"] label,
[id^="ojs-cell-"] input,
[id^="ojs-cell-"] select,
[id^="ojs-cell-"] button,
[id^="ojs-cell-"] table,
[id^="ojs-cell-"] th,
[id^="ojs-cell-"] td {
  font-size: 1rem !important;
}

[id^="ojs-cell-"] input[type="range"] {
  width: 100%;
}

/* --------------------------------------------------------------------------
   TABLES
   -------------------------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  box-shadow: var(--shadow-lg);
  border-radius: 0.5rem;
  overflow: hidden;
}

thead {
  background: var(--gradient-primary);
  color: white;
}

th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ribbon-light-gray);
  transition: background-color 0.2s ease;
}

tbody tr {
  transition: all 0.2s ease;
}

tbody tr:hover {
  background-color: rgba(30, 136, 229, 0.05);
  transform: scale(1.01);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Striped Tables */
tbody tr:nth-child(even) {
  background-color: rgba(248, 250, 252, 0.5);
}

/* --------------------------------------------------------------------------
   IMAGES & FIGURES
   -------------------------------------------------------------------------- */
img {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  margin: 2rem 0;
  transition: all 0.3s ease;
}

img:hover {
  box-shadow: var(--shadow-xl);
  transform: scale(1.02);
}

figure {
  margin: 2rem 0;
  text-align: center;
}

figcaption {
  margin-top: 1rem;
  color: var(--ribbon-gray);
  font-size: 22px !important;
  font-style: italic;
  line-height: 1.6;
}

/* Image Layouts */
.quarto-layout-panel {
  gap: 1.5rem;
  margin: 2rem 0;
}

/* --------------------------------------------------------------------------
   LINKS
   -------------------------------------------------------------------------- */
a {
  color: var(--ribbon-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  font-weight: 500;
}

a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background: var(--gradient-accent);
  transition: width 0.3s ease;
}

a:hover::after {
  width: 100%;
}

a:hover {
  color: var(--ribbon-primary-dark);
}

/* External Links */
a.external::after {
  content: ' ↗';
  font-size: 0.8em;
  position: relative;
  top: -0.2em;
  margin-left: 0.15em;
  width: auto;
  background: none;
}

a.external:hover::after {
  background: none;
}

/* --------------------------------------------------------------------------
   NAVIGATION & SIDEBAR
   -------------------------------------------------------------------------- */
.navbar {
  border-bottom: 3px solid transparent;
  border-image: var(--gradient-primary) 1;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.sidebar-navigation {
  background: linear-gradient(to bottom, white, var(--ribbon-bg));
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--ribbon-light-gray);
}

/* Sidebar de Quarto - docked */
#quarto-sidebar {
  width: 250px !important;
  min-width: 250px !important;
  font-size: 16px !important;
}

#quarto-sidebar .sidebar-menu-container {
  min-width: 220px !important;
  white-space: normal !important;
}

.sidebar-navigation,
.sidebar-navigation .sidebar-item,
.sidebar-navigation a {
  font-size: 16px !important;
}

.sidebar-navigation .sidebar-item {
  transition: all 0.2s ease;
  border-radius: 0.5rem;
  padding: 0.5rem;
}

.sidebar-navigation .sidebar-item:hover {
  background-color: rgba(30, 136, 229, 0.1);
  transform: translateX(5px);
}

/* TOC - Less intrusive with extra margin */
#TOC {
  background: linear-gradient(135deg, rgba(30, 136, 229, 0.05), rgba(255, 111, 0, 0.05));
  padding: 1.5rem;
  border-radius: 0.75rem;
  border-left: 4px solid var(--ribbon-primary);
  box-shadow: var(--shadow-md);
  margin-left: 2rem;  /* Push TOC further to the right */
}

/* Make TOC sidebar container have more spacing */
.toc-actions, aside.sidebar {
  padding-left: 1.5rem;
}

#TOC a {
  color: var(--ribbon-dark);
  transition: all 0.2s ease;
  padding: 0.25rem 0;
  display: block;
}

#TOC a:hover {
  color: var(--ribbon-primary);
  padding-left: 0.5rem;
}

#TOC .active {
  color: var(--ribbon-primary);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   BUTTONS & BADGES
   -------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  border: none;
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.85em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: var(--gradient-primary);
  color: white;
}

.badge-success {
  background: var(--ribbon-success);
  color: white;
}

.badge-warning {
  background: var(--ribbon-warning);
  color: white;
}

.badge-danger {
  background: var(--ribbon-danger);
  color: white;
}

/* --------------------------------------------------------------------------
   INTERACTIVE ELEMENTS
   -------------------------------------------------------------------------- */
/* Details/Summary (Accordions) */
details {
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 2px solid var(--ribbon-light-gray);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

details:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--ribbon-primary-light);
}

details[open] {
  border-color: var(--ribbon-primary);
  box-shadow: var(--shadow-lg);
}

summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ribbon-dark);
  font-size: 1.1em;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  user-select: none;
}

summary:hover {
  color: var(--ribbon-primary);
  background-color: rgba(30, 136, 229, 0.05);
}

summary::marker {
  color: var(--ribbon-primary);
  font-size: 1.2em;
}

/* Panel Tabset */
.panel-tabset .nav-tabs {
  border-bottom: 3px solid var(--ribbon-primary);
  margin-bottom: 0;
}

.panel-tabset .nav-link {
  border: none;
  color: var(--ribbon-gray);
  font-weight: 600;
  padding: 1rem 1.5rem;
  transition: all 0.3s ease;
}

.panel-tabset .nav-link:hover {
  color: var(--ribbon-primary);
  background-color: rgba(30, 136, 229, 0.05);
}

.panel-tabset .nav-link.active {
  background: var(--gradient-primary);
  color: white;
  border-radius: 0.5rem 0.5rem 0 0;
  box-shadow: var(--shadow-md);
}

.panel-tabset .tab-content {
  border: 2px solid var(--ribbon-light-gray);
  border-top: none;
  padding: 2rem;
  background: white;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: var(--shadow-md);
}

/* --------------------------------------------------------------------------
   MATH & EQUATIONS
   -------------------------------------------------------------------------- */
.math {
  font-size: 1.1em;
}

mjx-container {
  margin: 1.5rem 0;
}

mjx-container[display="true"] {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  margin: 1.5rem 0;
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
footer, .page-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 3px solid transparent;
  border-image: var(--gradient-primary) 1;
  text-align: center;
  color: var(--ribbon-gray);
  background: linear-gradient(to bottom, transparent, rgba(248, 250, 252, 0.5));
}

footer a {
  color: var(--ribbon-primary);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   ANIMATIONS
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Apply animations */
h1, h2 {
  animation: fadeIn 0.6s ease-out;
}

.callout {
  animation: slideInLeft 0.5s ease-out;
}

img {
  animation: fadeIn 0.8s ease-out;
}

/* --------------------------------------------------------------------------
   RESPONSIVE DESIGN
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .quarto-layout-panel {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
    margin-left: 0;
    padding-left: 1rem;
  }

  .hero {
    padding: 3rem 1.5rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  table {
    font-size: 0.9rem;
  }

  th, td {
    padding: 0.75rem;
  }
}

/* --------------------------------------------------------------------------
   PRINT STYLES
   -------------------------------------------------------------------------- */
@media print {
  .navbar, .sidebar-navigation, #TOC, footer {
    display: none;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  pre, code {
    border: 1px solid #ccc;
  }
}

/* --------------------------------------------------------------------------
   UTILITY CLASSES
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--ribbon-gray); }
.text-primary { color: var(--ribbon-primary); }
.text-accent { color: var(--ribbon-accent); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: calc(var(--spacing-unit) * 4); }
.mt-2 { margin-top: calc(var(--spacing-unit) * 8); }
.mt-3 { margin-top: calc(var(--spacing-unit) * 12); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: calc(var(--spacing-unit) * 4); }
.mb-2 { margin-bottom: calc(var(--spacing-unit) * 8); }
.mb-3 { margin-bottom: calc(var(--spacing-unit) * 12); }

.p-0 { padding: 0; }
.p-1 { padding: calc(var(--spacing-unit) * 4); }
.p-2 { padding: calc(var(--spacing-unit) * 8); }
.p-3 { padding: calc(var(--spacing-unit) * 12); }

/* --------------------------------------------------------------------------
   CUSTOM COMPONENTS
   -------------------------------------------------------------------------- */
/* Feature Cards */
.feature-card {
  background: white;
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-md);
  border-top: 4px solid var(--ribbon-primary);
  transition: all 0.3s ease;
  margin: 1rem 0;
}

.feature-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-5px);
  border-top-color: var(--ribbon-accent);
}

.feature-card h3 {
  margin-top: 0;
  color: var(--ribbon-primary);
}

/* Highlight Box */
.highlight-box {
  background: linear-gradient(135deg, rgba(30, 136, 229, 0.1), rgba(255, 111, 0, 0.1));
  padding: 2rem;
  border-radius: 0.75rem;
  border: 2px solid var(--ribbon-primary-light);
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}

/* Stats Display */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-item {
  text-align: center;
  padding: 1.5rem;
  background: white;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-md);
  border-top: 4px solid var(--ribbon-primary);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--ribbon-primary);
  display: block;
}

.stat-label {
  color: var(--ribbon-gray);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   SAGE CELL INTERACTIVE (SageMathCell embebido)
   -------------------------------------------------------------------------- */
.sage-cell {
  background: white;
  border: 2px solid var(--ribbon-primary-light);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

.sage-cell:hover {
  box-shadow: var(--shadow-xl);
  border-color: var(--ribbon-primary);
}

/* Botón de Ejecutar en SageCell */
.sage-cell .sagecell_evalButton {
  background: var(--gradient-primary) !important;
  color: white !important;
  border: none !important;
  padding: 0.75rem 2rem !important;
  border-radius: 0.5rem !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  box-shadow: var(--shadow-md) !important;
  margin-top: 1rem !important;
}

.sage-cell .sagecell_evalButton:hover {
  box-shadow: var(--shadow-lg) !important;
  transform: translateY(-2px) !important;
  background: var(--ribbon-primary-dark) !important;
}

/* Output de SageCell */
.sage-cell .sagecell_output {
  background: rgba(30, 136, 229, 0.03) !important;
  border-left: 4px solid var(--ribbon-primary) !important;
  border-radius: 0.5rem !important;
  padding: 1rem !important;
  margin-top: 1rem !important;
  font-family: var(--font-mono) !important;
  font-size: 0.9em !important;
  overflow-x: auto !important;
}

/* Editor de código en SageCell */
.sage-cell .CodeMirror {
  border: 1px solid var(--ribbon-light-gray) !important;
  border-radius: 0.5rem !important;
  font-size: 0.95em !important;
  min-height: 150px !important;
}

.sage-cell .CodeMirror-gutters {
  background: rgba(30, 136, 229, 0.05) !important;
  border-right: 1px solid var(--ribbon-light-gray) !important;
}
