/* ============================================
   Propuesta Backend - Estilos para pantalla e impresión PDF
   ============================================ */

:root {
  --primary: #0284c7;
  --primary-light: #38bdf8;
  --primary-soft: #e0f2fe;
  --accent: #0c4a6e;
  --accent-light: #7dd3fc;
  --dark: #0c4a6e;
  --light-bg: #f0f9ff;
  --border: #bae6fd;
}

/* Evitar saltos de página dentro de bloques importantes */
.phase-card, .spec-block, .cover-section, .tech-badge {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Mantener títulos con el contenido siguiente */
h2, h3, h4 {
  break-after: avoid;
  page-break-after: avoid;
}

/* Imágenes y logos en impresión */
img {
  max-width: 100%;
  height: auto;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* Fondo de secciones en impresión */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #fff !important;
  }

  .phase-card .card-header {
    background: #0284c7 !important;
    color: #fff !important;
  }

  .cover-section {
    background: linear-gradient(135deg, #afd9eb 0%, #38bdf8 50%, #7dd3fc 100%) !important;
    color: #005d8b !important;
  }

  .navbar, .btn-print-toggle, .no-print {
    display: none !important;
  }

  a[href]::after {
    content: none !important;
  }

  .container {
    max-width: 100%;
  }

  @page {
    size: A4;
    margin: 1.2cm;
  }
}

/* Pantalla */
.cover-section {
  background: linear-gradient(135deg, #afd9eb 0%, #38bdf8 50%, #7dd3fc 100%);
  color: #005d8b;
  padding: 3rem 0;
  border-radius: 0.5rem;
  margin-bottom: 2rem;
}

.cover-logo {
  max-width: 120px;
  height: auto;
}

.phase-card .card-header {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  font-weight: 600;
  padding: 0.75rem 1rem;
}

.phase-number {
  background: var(--accent);
  color: #d8e9f3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-right: 0.5rem;
}

.tech-badge {
  background: var(--light-bg);
  border: 1px solid var(--border);
  color: var(--primary);
  padding: 0.4rem 0.85rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  margin: 0.25rem;
  display: inline-flex;
  align-items: center;
}

.spec-list {
  margin-bottom: 0;
}
.spec-list li {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 3px solid var(--primary-light);
  list-style: none;
  position: relative;
}
.spec-list li:last-child {
  margin-bottom: 0;
}
.spec-list li strong {
  color: var(--accent);
  font-weight: 600;
}

.phase-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.phase-item:last-child {
  border-bottom: 0;
}
.phase-item-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}
.phase-item-content {
  flex: 1;
}
.phase-item-content strong {
  color: var(--accent);
}

/* Diagrama ER */
.er-diagram-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  overflow-x: auto;
  break-inside: avoid;
  page-break-inside: avoid;
}
.er-diagram-wrap .mermaid {
  display: flex;
  justify-content: center;
}
.er-diagram-wrap svg {
  max-width: 100%;
  height: auto;
}

.table-desc {
  font-size: 0.9rem;
}
.table-desc th {
  background: var(--primary-soft);
  color: var(--accent);
  font-weight: 600;
  border-color: var(--border);
}
.table-desc td {
  border-color: var(--border);
  vertical-align: top;
}
.table-desc code {
  background: var(--light-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.85em;
}

.efficiency-block {
  background: var(--light-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  break-inside: avoid;
  page-break-inside: avoid;
}
.efficiency-block h4 { margin-bottom: 0.5rem; }
.efficiency-table { font-size: 0.875rem; }

.advantage-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.advantage-item i {
  color: var(--primary);
  margin-top: 0.2rem;
}

.footer-proposal {
  border-top: 2px solid var(--primary);
  padding-top: 1rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: #555;
}

/* Mermaid: asegurar que el diagrama ER se imprima correctamente */
.mermaid {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.mermaid svg {
  max-width: 100% !important;
  height: auto !important;
}
