/* ==========================================================================
   Fijate Tools - Inspector y Decodificador de Certificados SSL/TLS (X.509)
   Estilos canónicos con soporte Dark/Light Theme y diseño responsivo
   ========================================================================== */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta Base Midnight Slate (Oscuro por defecto) */
  --bg-page: #0b0f17;
  --bg-card: #111827;
  --bg-card-alt: #162032;
  --bg-card-subtle: #1e293b;
  --bg-input: #0f172a;
  --border-color: #1e293b;
  --border-color-hover: #334155;
  --border-color-focus: #0284c7;

  /* Acentos de marca criptográfica */
  --primary-color: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: rgba(2, 132, 199, 0.15);
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;

  /* Estados del semáforo */
  --color-valid: #10b981;
  --color-valid-bg: rgba(16, 185, 129, 0.12);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-critical: #ef4444;
  --color-critical-bg: rgba(239, 68, 68, 0.12);
  --color-future: #8b5cf6;
  --color-future-bg: rgba(139, 92, 246, 0.12);

  /* Textos y contrastes */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="light"],
body.light-theme {
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-alt: #f8fafc;
  --bg-card-subtle: #edf2f7;
  --bg-input: #f8fafc;
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --border-color-focus: #0284c7;

  --primary-color: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: rgba(2, 132, 199, 0.12);

  --color-valid-bg: rgba(16, 185, 129, 0.1);
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-critical-bg: rgba(239, 68, 68, 0.1);

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

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

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

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

h1, h2, h3, h4, h5, h6,
.brand-title,
.card-heading,
.sans-title,
.guide-title {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
}

.mono, code, pre {
  font-family: var(--font-mono);
}

/* ==========================================================================
   Layout Principal y Anuncios
   ========================================================================== */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  width: 100%;
}

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

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

/* ==========================================================================
   Selector de Modo (Tabs)
   ========================================================================== */
.mode-tabs {
  display: flex;
  gap: 0.5rem;
  background-color: var(--bg-card-alt);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-card-subtle);
}

.tab-btn.active {
  background-color: var(--primary-color);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Formularios y Controles de Entrada
   ========================================================================== */
.form-domain-box,
.form-pem-box {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.form-row-domain {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.host-input-wrap {
  flex: 3 1 320px;
}

.port-input-wrap {
  flex: 1 1 100px;
  max-width: 140px;
}

.action-submit-wrap {
  flex: 2 1 200px;
}

.input-with-icon {
  display: flex;
  align-items: center;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-with-icon:focus-within {
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-icon-prefix {
  padding: 0 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  background-color: var(--bg-card-subtle);
  border-right: 1px solid var(--border-color);
  user-select: none;
  display: flex;
  align-items: center;
  height: 42px;
}

.text-input {
  width: 100%;
  height: 42px;
  padding: 0 0.85rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-with-icon .text-input {
  border: none;
  border-radius: 0;
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
}

.text-input:focus {
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.port-input {
  font-family: var(--font-mono);
  text-align: center;
}

/* Botones principales */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 42px;
  padding: 0 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background-color: var(--bg-card-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color-hover);
}

/* Muestra rápida de dominios / chips */
.quick-examples {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.quick-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
}

.btn-chip,
.btn-chip-sample {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-chip:hover,
.btn-chip-sample:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Área de texto PEM */
.pem-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pem-header-bar label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pem-actions-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-file-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-file-upload:hover {
  border-color: var(--primary-color);
  color: var(--text-primary);
}

.btn-text-action {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}

.btn-text-action:hover {
  color: var(--color-critical);
}

.pem-textarea {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.4;
  outline: none;
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.2s ease;
}

.pem-textarea:focus {
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

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

.pem-footer-bar .btn-primary {
  width: auto;
  min-width: 220px;
}

/* ==========================================================================
   Estado de Carga / Spinner
   ========================================================================== */
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 1.5rem;
  text-align: center;
  background-color: var(--bg-card-alt);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.spinner-circle {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-text {
  font-weight: 500;
  color: var(--text-secondary);
}

/* ==========================================================================
   Barra de Acciones y Selector de Cadena
   ========================================================================== */
.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.chain-selector-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
}

.chain-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.chain-badge-btn {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chain-badge-btn:hover {
  border-color: var(--primary-color);
  color: var(--text-primary);
}

.chain-badge-btn.active {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.results-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-action-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 36px;
  padding: 0 0.85rem;
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-outline:hover {
  background-color: var(--bg-card-subtle);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

/* ==========================================================================
   Semáforo y Banner de Cuenta Atrás
   ========================================================================== */
.card-status-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--bg-card-alt) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}

.card-status-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background-color: var(--color-valid);
  transition: background-color 0.3s ease;
}

.card-status-banner.status-valid::before { background-color: var(--color-valid); }
.card-status-banner.status-warning::before { background-color: var(--color-warning); }
.card-status-banner.status-critical::before { background-color: var(--color-critical); }
.card-status-banner.status-expired::before { background-color: var(--color-critical); }
.card-status-banner.status-not_yet_valid::before { background-color: var(--color-future); }

.status-left {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1 1 300px;
}

.status-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--color-valid-bg);
  border: 1px solid var(--color-valid);
  color: var(--color-valid);
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  width: fit-content;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 10px currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.status-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.status-dates-summary {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.date-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.date-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.date-val {
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* Cuenta atrás */
.countdown-widget {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  flex: 1 1 280px;
}

.countdown-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.countdown-clock {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--bg-card-subtle);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.clock-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
}

.clock-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.clock-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.clock-sep {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-top: -0.5rem;
}

.progress-bar-wrap {
  width: 100%;
  max-width: 250px;
  height: 6px;
  background-color: var(--bg-card-subtle);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--color-valid));
  transition: width 0.3s ease;
}

/* ==========================================================================
   Parrilla de Información Principal
   ========================================================================== */
.cert-grid-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.info-card {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--primary-color);
}

.card-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.info-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.data-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.3rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .data-row,
body.light-theme .data-row {
  border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
}

.data-row.highlight {
  background-color: var(--bg-card-subtle);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border-bottom: none;
}

.row-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
}

.row-val {
  color: var(--text-secondary);
  word-break: break-all;
}

.row-val.strong {
  color: var(--text-primary);
  font-weight: 600;
}

.row-val-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-crypto-type {
  background-color: var(--primary-light);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.badge-security-level {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background-color: var(--color-valid-bg);
  color: var(--color-valid);
  border: 1px solid var(--color-valid);
  width: fit-content;
}

.badge-role {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.serial-number-text {
  font-size: 0.75rem;
  word-break: break-all;
  line-height: 1.3;
}

.fingerprint-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  background-color: var(--bg-input);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.small-fp {
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
}

.btn-mini-copy {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s ease;
}

.btn-mini-copy:hover {
  color: var(--primary-color);
}

/* ==========================================================================
   Nombres Alternativos del Sujeto (SANs)
   ========================================================================== */
.card-sans-section {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.sans-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.sans-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--accent-cyan);
}

.sans-title {
  font-size: 1.05rem;
}

.sans-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: block;
}

.sans-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sans-count-badge {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

.sans-search-wrap {
  width: 220px;
}

.sans-search-input {
  height: 36px;
  font-size: 0.85rem;
}

.sans-grid-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.san-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.san-pill:hover {
  border-color: var(--primary-color);
  color: var(--text-primary);
}

.san-pill.is-wildcard {
  border-color: rgba(6, 182, 212, 0.4);
  background-color: rgba(6, 182, 212, 0.08);
  color: #38bdf8;
}

.san-wildcard-badge {
  font-size: 0.7rem;
  background-color: var(--accent-cyan);
  color: #042f2e;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 3px;
}

/* ==========================================================================
   Extensiones Avanzadas (Acordeón)
   ========================================================================== */
.card-extensions-section {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  overflow: hidden;
}

.extensions-accordion summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--bg-card-alt);
  user-select: none;
  transition: background-color 0.2s ease;
}

.extensions-accordion summary::-webkit-details-marker {
  display: none;
}

.extensions-accordion summary:hover {
  background-color: var(--bg-card-subtle);
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--primary-color);
}

.summary-left span {
  color: var(--text-primary);
  font-size: 0.95rem;
}

.accordion-chevron {
  font-size: 1.1rem;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.extensions-accordion[open] .accordion-chevron {
  transform: rotate(180deg);
}

.extensions-content {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: var(--bg-card);
}

.wrap-word {
  word-break: break-all;
}

/* ==========================================================================
   Guía Didáctica y SEO
   ========================================================================== */
.tool-guide-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.guide-title {
  font-size: 1.35rem;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.guide-card {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.guide-card h4 {
  font-size: 0.98rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.guide-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   Modales Canónicos
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.2s ease;
}

.modal-alert-card {
  max-width: 440px;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-card-header h3 {
  font-size: 1.1rem;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-close-modal:hover {
  background-color: var(--bg-card-subtle);
  color: var(--text-primary);
}

.modal-card-body {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-alert-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.code-preview-block {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-primary);
  max-height: 400px;
}

.modal-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card-alt);
}

.modal-card-footer .btn {
  width: auto;
  min-width: 110px;
}

/* ==========================================================================
   Vista de Impresión Oficial A4 (.print-sheet)
   ========================================================================== */
.print-sheet {
  display: none;
}

@media print {
  /* Ocultar interfaz web y anuncios */
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  .app-header,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .card-main,
  .fijate-footer,
  .modal-overlay {
    display: none !important;
  }

  .print-sheet {
    display: block !important;
    max-width: 210mm;
    margin: 0 auto;
    padding: 10mm;
    color: #111827 !important;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2pt solid #0284c7;
    padding-bottom: 8mm;
    margin-bottom: 8mm;
  }

  .print-title-box h1 {
    font-size: 16pt !important;
    color: #0f172a !important;
    margin-bottom: 2mm;
  }

  .print-subtitle {
    font-size: 10pt !important;
    color: #475569 !important;
  }

  .print-meta {
    text-align: right;
    font-size: 9pt !important;
    color: #334155 !important;
    line-height: 1.4;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6mm;
    page-break-inside: avoid;
  }

  .print-table th {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    text-align: left;
    padding: 3mm 4mm;
    font-size: 10pt !important;
    border: 1pt solid #cbd5e1;
  }

  .print-table td {
    padding: 2.5mm 4mm;
    font-size: 9.5pt !important;
    border: 1pt solid #e2e8f0;
    color: #1e293b !important;
  }

  .print-footer-notice {
    margin-top: 10mm;
    border-top: 1pt solid #e2e8f0;
    padding-top: 4mm;
    font-size: 8pt !important;
    color: #64748b !important;
    text-align: center;
  }
}

/* ==========================================================================
   Ajustes Responsivos y Móvil (Controles táctiles >= 40px)
   ========================================================================== */
@media (max-width: 992px) {
  .cert-grid-summary {
    grid-template-columns: 1fr;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .tool-layout {
    padding: 0 0.5rem;
    margin-top: 1rem;
  }

  .card-main {
    padding: 1rem;
  }

  .form-row-domain {
    flex-direction: column;
    gap: 0.75rem;
  }

  .host-input-wrap,
  .port-input-wrap,
  .action-submit-wrap {
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  .card-status-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .countdown-widget {
    align-items: flex-start;
    width: 100%;
  }

  .progress-bar-wrap {
    max-width: 100%;
  }

  .sans-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .sans-search-wrap {
    width: 100%;
  }

  .pem-footer-bar .btn-primary {
    width: 100%;
  }
}
