/* ==========================================================================
   Baremador clínico YGTSS de severidad de tics - Estilos canónicos
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema oscuro por defecto */
  --bg-page: #0b0f19;
  --bg-card: #111827;
  --bg-card-secondary: #1a2234;
  --bg-card-hover: #1f2a40;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.25);
  --motor-color: #3b82f6;
  --vocal-color: #8b5cf6;
  --impairment-color: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 20px 40px -4px rgba(0, 0, 0, 0.7);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="light"] {
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-secondary: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-color-focus: #2563eb;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.2);
  --motor-color: #2563eb;
  --vocal-color: #7c3aed;
  --impairment-color: #d97706;

  --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.08);
  --shadow-modal: 0 20px 35px -5px rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  flex: 1;
}

.tool-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

@media (min-width: 1536px) {
  .tool-with-sidebar {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

.tool-main-content {
  min-width: 0;
  width: 100%;
}

.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .card-main {
    padding: 2.25rem;
  }
}

.tool-header-intro {
  margin-bottom: 1.75rem;
  text-align: center;
}

.badge-clinical {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.tool-hero-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.tool-hero-subtitle {
  color: var(--text-secondary);
  font-size: 0.98rem;
  max-width: 760px;
  margin: 0 auto;
}

/* Cuadrícula de dominios clínicos YGTSS (Motor vs Vocal) */
.ygtss-domains-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

@media (min-width: 900px) {
  .ygtss-domains-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.domain-column {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.domain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.domain-title-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.domain-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.domain-column.motor .domain-icon {
  background: rgba(59, 130, 246, 0.15);
  color: var(--motor-color);
}

.domain-column.vocal .domain-icon {
  background: rgba(139, 92, 246, 0.15);
  color: var(--vocal-color);
}

.domain-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
}

.domain-subtotal-badge {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.domain-column.motor .domain-subtotal-badge {
  color: var(--motor-color);
}

.domain-column.vocal .domain-subtotal-badge {
  color: var(--vocal-color);
}

/* Ítems de dimensión y selector */
.dimension-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  transition: var(--transition-fast);
}

.dimension-card:hover {
  border-color: var(--text-muted);
}

.dimension-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.dimension-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dimension-score-val {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
}

.dimension-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

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

.ygtss-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 40px 0 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-primary);
  background-color: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  appearance: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition-fast);
}

.ygtss-select:focus {
  outline: none;
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.ygtss-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
  padding: 0.4rem;
}

.select-arrow-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

/* Tarjeta de deterioro global funcional */
.impairment-section {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 1.5rem 0 2rem;
}

.impairment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.impairment-score-badge {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--impairment-color);
  padding: 0.25rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

/* Tablero de resultados y baremos */
.results-dashboard {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  margin: 2rem 0;
}

.score-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 768px) {
  .score-summary-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  text-align: center;
}

.summary-val {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
}

.summary-val.motor { color: var(--motor-color); }
.summary-val.vocal { color: var(--vocal-color); }
.summary-val.tics { color: var(--primary); }
.summary-val.global { color: #10b981; }

.summary-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-weight: 500;
}

/* Diagnóstico clínico y termómetro */
.diagnostic-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 640px) {
  .diagnostic-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.diag-title-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.diag-badge {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
}

/* Gráficos Canvas 2D */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}

.chart-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.chart-canvas {
  width: 100%;
  max-width: 380px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Botones de acción */
.btn-ygtss-primary,
.btn-ygtss-secondary,
.btn-ygtss-outline {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border: 1px solid transparent;
}

.btn-ygtss-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-ygtss-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-ygtss-secondary {
  background: var(--bg-card-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-ygtss-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-ygtss-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-ygtss-outline:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.actions-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .actions-row.dual {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   HOJA DE IMPRESIÓN A4 OFICIAL (Lección 238: Prohibición de controles web)
   ========================================================================== */
#print-sheet {
  display: none;
}

@media print {
  /* Ocultar elementos web, cabecera, publicidad y botones */
  header.app-header,
  footer.fijate-footer,
  aside.tool-ad-sidebar,
  section.tools-ad-banner-section,
  .card-main,
  .seo-guide-section,
  .actions-row,
  .btn-icon {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .main-wrapper.tool-layout {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tool-with-sidebar {
    display: block !important;
  }

  #print-sheet {
    display: block !important;
    width: 100% !important;
    max-width: 210mm !important;
    margin: 0 auto !important;
    padding: 15mm 15mm !important;
    background: #ffffff !important;
    color: #111827 !important;
  }

  .print-header {
    border-bottom: 2px solid #111827;
    padding-bottom: 8mm;
    margin-bottom: 6mm;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
  }

  .print-title {
    font-size: 18pt;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 2mm;
  }

  .print-subtitle {
    font-size: 10pt;
    color: #4b5563;
  }

  .print-meta-box {
    text-align: right;
    font-size: 9pt;
    color: #4b5563;
  }

  .print-patient-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4mm;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 4mm;
    border-radius: 4px;
    margin-bottom: 6mm;
    font-size: 9.5pt;
  }

  .print-scores-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6mm;
    font-size: 9.5pt;
  }

  .print-scores-table th,
  .print-scores-table td {
    border: 1px solid #d1d5db;
    padding: 2.5mm 3.5mm;
    text-align: left;
  }

  .print-scores-table th {
    background: #f9fafb;
    font-weight: 700;
  }

  .print-total-highlight {
    background: #f3f4f6;
    font-weight: 700;
  }

  .print-summary-box {
    border: 1.5px solid #111827;
    padding: 4mm;
    margin-bottom: 6mm;
    border-radius: 4px;
    page-break-inside: avoid;
  }

  .print-signatures-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15mm;
    margin-top: 10mm;
    page-break-inside: avoid;
  }

  .print-signature-box {
    border-top: 1px dashed #6b7280;
    padding-top: 2mm;
    text-align: center;
    font-size: 9pt;
    color: #4b5563;
  }
}
