/* ═══════════════════════════════════════════
   META TARGETING EXPLORER — Styles
   ═══════════════════════════════════════════ */

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

:root {
  --blue:       #1877F2;
  --blue-dark:  #0d5fcf;
  --blue-light: #e7f0ff;
  --green:      #2ecc71;
  --red:        #e74c3c;
  --orange:     #f39c12;
  --gray-50:    #f8f9fa;
  --gray-100:   #f0f2f5;
  --gray-200:   #e4e6ea;
  --gray-400:   #8a8d91;
  --gray-700:   #444950;
  --gray-900:   #1c1e21;
  --radius:     8px;
  --shadow:     0 2px 8px rgba(0,0,0,.10);
  --shadow-lg:  0 4px 20px rgba(0,0,0,.13);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  font-size: 14px;
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: var(--blue);
  color: white;
  padding: 0 24px;
  min-height: 60px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.version-badge {
  font-size: 10px;
  font-weight: 700;
  color: #1877F2;
  background: #ffffff;
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.5px;
  align-self: center;
}

/* ── SYNC WIDGET ── */
.sync-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: rgba(0,0,0,.18);
  border-radius: var(--radius);
  min-width: 180px;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
}
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--gray-400);
  transition: background 0.3s;
}
.sync-widget--idle   .sync-dot { background: #27ae60; }
.sync-widget--active .sync-dot {
  background: #f39c12;
  animation: sync-pulse 1s ease-in-out infinite;
}
@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}
.sync-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
#sync-label {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  overflow: hidden;
  text-overflow: ellipsis;
}
.sync-bar-wrap {
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
}
.sync-bar-fill {
  height: 100%;
  background: #f39c12;
  border-radius: 2px;
  transition: width 0.5s ease;
  min-width: 4px;
}

/* ── API USAGE WIDGET ── */
.api-usage-widget {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(0,0,0,.18);
  border-radius: var(--radius);
  white-space: nowrap;
  margin-left: auto;
}
.api-usage-title {
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-right: 2px;
}
.api-pill {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  min-width: 38px;
  text-align: center;
  cursor: default;
  transition: background .3s, color .3s;
}
.api-pill--none   { background: rgba(255,255,255,.12); color: rgba(255,255,255,.55); }
.api-pill--ok     { background: rgba(46,204,113,.3);   color: #b7f5d0; }
.api-pill--warn   { background: rgba(243,156,18,.4);   color: #ffe082; }
.api-pill--danger { background: rgba(231,76,60,.45);   color: #ffc8c4; }

.api-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}
.api-stat-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.locale-area {
  display: flex;
  align-items: center;
  gap: 8px;
}
.locale-label {
  font-size: 12px;
  color: rgba(255,255,255,.8);
  white-space: nowrap;
}
.locale-select {
  padding: 6px 10px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  background: rgba(255,255,255,.2);
  color: white;
  cursor: pointer;
  outline: none;
}
.locale-select:focus { background: rgba(255,255,255,.3); }
.locale-select option { background: #1877F2; color: white; }

.token-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.token-display {
  display: flex;
  align-items: center;
  gap: 8px;
}
.token-masked {
  font-family: monospace;
  font-size: 12px;
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.15);
  padding: 4px 12px;
  border-radius: var(--radius);
  letter-spacing: 1px;
  white-space: nowrap;
}
.token-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}
#token-input {
  width: 280px;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  outline: none;
  background: rgba(255,255,255,.2);
  color: white;
}
#token-input::placeholder { color: rgba(255,255,255,.7); }
#token-input:focus { background: rgba(255,255,255,.3); }

/* ── STATUS BADGE ── */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-ok      { background: rgba(46,204,113,.25); color: #b7f5d0; }
.status-error   { background: rgba(231,76,60,.25);  color: #ffc8c4; }
.status-unknown { background: rgba(255,255,255,.15); color: rgba(255,255,255,.8); }

/* ── BUTTONS ── */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--blue); color: white; }
.btn-primary:hover:not(:disabled)  { background: var(--blue-dark); }
.btn-secondary { background: white; color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-secondary:hover:not(:disabled){ background: var(--gray-50); }
.btn-danger   { background: var(--red); color: white; }
.btn-danger:hover:not(:disabled)   { background: #c0392b; }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 2px;
  padding: 12px 24px 0;
  background: white;
  border-bottom: 2px solid var(--gray-200);
}
.tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-400);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.tab:hover  { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── MAIN ── */
main {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── TAB PANELS ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── PANEL HEADER ── */
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-header h2 { font-size: 20px; font-weight: 700; }
.subtitle { color: var(--gray-400); font-size: 13px; margin-top: 3px; }
.cache-updated { color: var(--gray-400); font-size: 11px; margin-top: 4px; font-style: italic; }
.panel-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.filter-bar input, .search-bar input {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--gray-200);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.filter-bar input:focus, .search-bar input:focus { border-color: var(--blue); }

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.search-bar input { min-width: 260px; }

.count-badge {
  background: var(--blue-light);
  color: var(--blue);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── TABLES ── */
.table-wrap {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: calc(100vh - 320px);
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1.5px solid var(--gray-200);
  white-space: nowrap;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--blue); }
th .sort-icon { margin-left: 4px; opacity: .5; }

/* U4: Indicador visual de columna ordenada */
th.sorted { color: var(--blue); background: var(--blue-light); }
th.sorted .sort-icon { opacity: 1; }

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

.audience-cell { font-variant-numeric: tabular-nums; }
.path-cell { color: var(--gray-400); font-size: 12px; }
.desc-cell { max-width: 480px; white-space: normal; word-break: break-word; line-height: 1.4; }

/* Chips de tipo */
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.chip-ct1  { background: #e3f2fd; color: #1565C0; }
.chip-ct2  { background: #f3e5f5; color: #7B1FA2; }
.chip-ct3  { background: #e8f5e9; color: #2E7D32; }
.chip-ct4  { background: #fff3e0; color: #E65100; }
.chip-ct5  { background: #fce4ec; color: #880E4F; }
.chip-ct6  { background: #e0f2f1; color: #00695C; }
.chip-ct7  { background: #f1f8e9; color: #558B2F; }
.chip-ct8  { background: #ede7f6; color: #4527A0; }
.chip-ct9  { background: #fff8e1; color: #F57F17; }
.chip-ct10 { background: #e8eaf6; color: #283593; }
.chip-ct11 { background: #efebe9; color: #4E342E; }
.chip-ct12 { background: #e0f7fa; color: #00838F; }
.chip-NORMAL          { background: #e8f5e9; color: #2E7D32; }
.chip-DEPRECATING     { background: #fff3e0; color: #E65100; }
.chip-NON-DELIVERABLE { background: #ffebee; color: #B71C1C; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
  font-size: 15px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-state svg { display: block; margin: 0 auto 12px; opacity: .3; }

/* ── PROGRESS BAR ── */
.progress-section {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.progress-bar-wrap {
  background: var(--gray-100);
  border-radius: 20px;
  height: 12px;
  overflow: hidden;
  margin-bottom: 10px;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), #42a5f5);
  border-radius: 20px;
  transition: width .4s ease;
}
.progress-label { font-size: 13px; color: var(--gray-400); margin-top: 6px; }

/* ── LOADING OVERLAY ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 16px;
}
#loading-overlay.hidden { display: none; }
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { color: var(--gray-400); font-size: 14px; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  z-index: 1000;
  transition: opacity .3s;
  max-width: 360px;
}
.toast.hidden { display: none; }
.toast.toast-error { background: var(--red); }
.toast.toast-ok    { background: #27ae60; }

/* ── CRAWL PROGRESS ── */
.crawl-progress-box {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 16px;
  border-left: 4px solid var(--blue);
}
.crawl-progress-box.hidden { display: none; }
.crawl-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 14px;
}
.crawl-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 8px;
}
.crawl-log {
  margin-top: 10px;
  font-size: 11px;
  font-family: monospace;
  color: var(--gray-400);
  background: var(--gray-50);
  border-radius: 4px;
  padding: 8px 10px;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.6;
}
.hidden { display: none !important; }

/* ── SECTION DIVIDER ── */
.section-divider {
  margin: 32px 0 16px;
  padding: 10px 16px;
  background: var(--gray-100);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-700);
  letter-spacing: .3px;
}

/* ── TYPE FILTER SELECT ── */
.type-filter-select {
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1.5px solid var(--gray-200);
  font-size: 13px;
  outline: none;
  background: white;
  cursor: pointer;
}
.type-filter-select:focus { border-color: var(--blue); }

/* ── CACHE STATUS COLORS ── */
.cache-updated--fresh { color: #27ae60; }
.cache-updated--stale { color: var(--orange); }
.cache-updated--old   { color: var(--red); }

/* ── TAB BADGES ── */
.tab-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
  background: var(--blue-light);
  color: var(--blue);
  transition: background .3s, color .3s;
}
.tab-badge:empty { display: none; }
.tab-badge--sub {
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 10px;
  margin-left: 4px;
}
.tab-badge--up   { background: #e8f5e9; color: #2E7D32; }
.tab-badge--down { background: #ffebee; color: #B71C1C; }
.tab-badge--same { background: var(--blue-light); color: var(--blue); }

/* ── SELECTION FAB ── */
.selection-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 24px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  z-index: 500;
  box-shadow: var(--shadow-lg);
  transition: background .15s, transform .15s;
}
.selection-fab:hover { background: var(--blue-dark); transform: translateY(-2px); }

/* ── SELECTION DRAWER ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: white;
  border-radius: 14px;
  padding: 32px 28px 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  animation: slideUp .18s ease;
  text-align: center;
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 8px;
}
.modal-desc {
  color: var(--gray-700);
  margin: 0 0 14px;
  font-size: 14px;
}
.modal-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  text-align: left;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.modal-list li {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--gray-900);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-list li::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
}
.modal-list li:last-child { border-bottom: none; }
.modal-note {
  color: var(--gray-400);
  font-size: 12px;
  margin-left: auto;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-actions .btn { min-width: 110px; }

.selection-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 600;
}
.selection-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: white;
  z-index: 700;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
}
.selection-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1.5px solid var(--gray-200);
  font-size: 16px;
  font-weight: 700;
}
.selection-drawer-header .close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--gray-400);
  padding: 0 6px;
  border-radius: var(--radius);
  line-height: 1;
}
.selection-drawer-header .close-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.selection-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}
.selection-group-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--gray-400);
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gray-100);
}
.selection-group-label:first-child { margin-top: 0; }
.selection-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--gray-50);
  margin-bottom: 5px;
}
.selection-item-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.selection-item-meta {
  font-size: 11px;
  color: var(--gray-400);
  white-space: nowrap;
}
.selection-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}
.selection-item-remove:hover { color: var(--red); background: #ffeae8; }
.selection-drawer-footer {
  padding: 16px 24px;
  border-top: 1.5px solid var(--gray-200);
  display: flex;
  gap: 8px;
}

/* ── CHECKBOX COL ── */
th.col-select, td.col-select {
  width: 36px;
  padding: 8px 4px 8px 14px;
}
.select-checkbox {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--blue);
  display: block;
}

/* ── TABLE TRUNCATED (P3) ── */
.table-truncated {
  text-align: center;
  padding: 12px 20px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* ── RESPONSIVE (U6) ── */
@media (max-width: 1200px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 8px;
  }
  .api-usage-widget {
    margin-left: 0;
    order: 5;
  }
  .locale-area {
    order: 3;
  }
  .token-area {
    order: 4;
    width: 100%;
  }
}

@media (max-width: 768px) {
  header { padding: 0 12px; }
  .header-inner { gap: 6px; }
  .logo span { font-size: 15px; }
  #token-input { width: 100%; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding: 8px 12px 0; }
  .tab { padding: 8px 14px; font-size: 13px; }
  .tab-badge--sub { display: none; }
  main { padding: 12px; }
  .panel-header { flex-direction: column; }
  .panel-actions { width: 100%; }
  .filter-bar { flex-wrap: wrap; }
  .cache-stats-bar { flex-wrap: wrap; padding: 4px 12px; }
  .stat-item { padding: 6px 12px 6px 0; margin-right: 12px; }
  .selection-drawer { width: 100vw; }
}

@media (max-width: 480px) {
  .logo svg { width: 22px; height: 22px; }
  .logo span { font-size: 13px; }
  .panel-actions { flex-wrap: wrap; }
  .panel-actions .btn { flex: 1; min-width: 120px; text-align: center; }
}

/* ═══════════════════════════════════════════
   RECOMENDADOR
   ═══════════════════════════════════════════ */

.rec-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Chat panel ── */
.rec-chat-panel {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rec-messages {
  flex: 1;
  min-height: 300px;
  max-height: 450px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rec-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.rec-msg--user {
  align-self: flex-end;
  background: var(--blue);
  color: white;
  border-bottom-right-radius: 4px;
}

.rec-msg--assistant {
  align-self: flex-start;
  background: var(--gray-100);
  color: var(--gray-900);
  border-bottom-left-radius: 4px;
}

.rec-msg--error {
  align-self: center;
  background: #ffebee;
  color: var(--red);
  font-size: 13px;
}

/* Typing indicator */
.rec-msg--typing {
  padding: 10px 18px;
}
.typing-dots span {
  animation: typingBounce 1.4s infinite;
  font-size: 24px;
  line-height: 1;
  display: inline-block;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ── Input area ── */
.rec-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1.5px solid var(--gray-200);
  background: var(--gray-50);
}

.rec-input {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--gray-200);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  transition: border-color .15s;
}
.rec-input:focus { border-color: var(--blue); }

.rec-generate-area {
  padding: 12px 16px;
  border-top: 1.5px solid var(--gray-200);
  text-align: center;
  background: var(--blue-light);
}

.btn-lg {
  padding: 12px 32px;
  font-size: 15px;
}

/* ── Proposal cards ── */
.rec-proposals {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rec-proposals-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.rec-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 5px solid var(--blue);
  padding: 20px;
}

.rec-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rec-card-tier {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  color: white;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.rec-card-audience {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 4px 10px;
  border-radius: 12px;
}

.rec-card-desc {
  color: var(--gray-700);
  font-size: 14px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.rec-card-rationale {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-200);
  font-size: 12px;
  color: var(--gray-400);
  line-height: 1.5;
  font-style: italic;
}

/* ── Layers (AND/OR groups) ── */
.rec-layers {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rec-layer {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 12px;
}

.rec-layer--exclude {
  background: #fff5f5;
}

.rec-layer-connector {
  text-align: center;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: 1px;
}

.rec-layer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.rec-layer-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
}
.rec-layer-badge--OR { background: #e3f2fd; color: #1565c0; }
.rec-layer-badge--AND { background: #e8f5e9; color: #2e7d32; }
.rec-layer-badge--EXCLUDE { background: #ffebee; color: #c62828; }

.rec-layer-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
}

.rec-layer-reason {
  margin: 0 0 8px 0;
  padding: 6px 10px;
  background: #f0f7ff;
  border-left: 3px solid var(--blue);
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  color: var(--gray-700);
  font-style: italic;
  line-height: 1.4;
}

.rec-layer--exclude .rec-layer-reason {
  background: #fff5f5;
  border-left-color: #e57373;
}

.rec-layer-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rec-item-chip {
  display: inline-block;
  padding: 4px 10px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  font-size: 12px;
  color: var(--gray-900);
  cursor: default;
  transition: background .15s;
}
.rec-item-chip:hover { background: var(--blue-light); }

.rec-item-chip--exclude {
  background: #fff5f5;
  border-color: #ffcdd2;
  color: #c62828;
}
.rec-item-chip--exclude:hover { background: #ffebee; }

.rec-item-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.rec-item-id {
  font-size: 10px;
  color: var(--gray-500);
  font-family: 'SF Mono', 'Fira Code', monospace;
  padding-left: 4px;
  letter-spacing: 0.3px;
  user-select: all;
}

.rec-item-id--exclude {
  color: #e57373;
}

.rec-item-reason {
  width: 100%;
  margin: 2px 0 6px 0;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--gray-600);
  line-height: 1.4;
  font-style: italic;
  border-left: 2px solid var(--blue);
  background: #f8fbff;
  border-radius: 0 4px 4px 0;
}

.rec-item-reason--exclude {
  border-left-color: #e57373;
  background: #fffafa;
}

/* ── Progress bar de entrevista ── */
.rec-progress-wrap {
  padding: 10px 16px 0;
  background: white;
}
.rec-progress-track {
  background: var(--gray-100);
  border-radius: 20px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 5px;
}
.rec-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), #42a5f5);
  border-radius: 20px;
  transition: width .5s ease;
}
.rec-progress-label {
  font-size: 11px;
  color: var(--gray-400);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}

/* ── Typewriter cursor ── */
.rec-cursor {
  display: inline-block;
  color: var(--blue);
  animation: cursorBlink .7s step-end infinite;
  font-weight: 300;
  margin-left: 1px;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.rec-msg--typewriter {
  /* Sin estilos extra — la clase se elimina al terminar */
}

/* ── Warning de alucinación ── */
.rec-msg--warning {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fff8e1;
  border: 1.5px solid #ffc107;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #795548;
  line-height: 1.5;
  max-width: 100%;
}
.rec-warning-icon {
  flex-shrink: 0;
  font-size: 16px;
  margin-top: 1px;
}

/* ── Type badges en chips de items ── */
.rec-type-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-right: 5px;
  vertical-align: middle;
}
.rec-type-badge--interest    { background: #e3f2fd; color: #1565c0; }
.rec-type-badge--behavior    { background: #f3e5f5; color: #7b1fa2; }
.rec-type-badge--demographic { background: #e8f5e9; color: #2e7d32; }
.rec-type-badge--advdemo     { background: #fff3e0; color: #e65100; }
.rec-type-badge--other       { background: var(--gray-100); color: var(--gray-700); }

/* ── Botón copiar propuesta ── */
.rec-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.rec-card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rec-copy-btn {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 10px;
  transition: background .15s, color .15s;
}
.rec-copy-btn--done {
  background: #e8f5e9 !important;
  color: #2e7d32 !important;
  border-color: #a5d6a7 !important;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .rec-msg { max-width: 95%; }
  .rec-card { padding: 14px; }
  .rec-card-header { flex-wrap: wrap; gap: 8px; }
}

/* ─── Banner de indexación ───────────────────────────────────────────────── */
.rec-indexing-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #5d4037;
}

.rec-indexing-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.rec-indexing-text {
  line-height: 1.4;
}
