/* ================================================
   IA PANEL
   ================================================ */

.ia-panel-wrapper {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateY(calc(100% - 35px));
  transition: transform 1.8s cubic-bezier(0.06, 0.95, 0.18, 1.0);
}

.ia-panel-wrapper.ia-open {
  transform: translateY(0);
  top: 46px;
  bottom: 0;
}

/* ── Barra trigger ── */
.ia-trigger-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-filters);
  border-top: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  min-height: 35px;
}

.ia-trigger-bar:hover { background: var(--card-hover); }

.ia-trigger-text {
  font-size: 10px;
  font-style: italic;
  color: var(--text-muted);
  opacity: 0.5;
}

.ia-trigger-bar:hover .ia-trigger-text { opacity: 0.85; }

.ia-trigger-arrow {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  transition: transform 0.6s ease, color 0.3s;
}

.ia-panel-wrapper.ia-open .ia-trigger-arrow {
  transform: rotate(180deg);
  color: #c8a000;
}

/* ── Panel principal ── */
.ia-panel {
  flex: 1;
  overflow: hidden;
  background: linear-gradient(135deg, #FFE033 0%, #F5C400 35%, #FFD000 65%, #FFEA00 100%);
  border-top: 3px solid #FFF176;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════ */
/* ── Partículas (Efecto Burbujas Mágicas) ──     */
/* ══════════════════════════════════════════════ */
.ia-aura {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Vital para poder hacer clic a través de ellas */
  overflow: hidden;
  z-index: 0;
}

.ia-particle {
  position: absolute;
  bottom: -50px; /* Empiezan escondidas abajo del todo */
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4); /* Color blanquecino/dorado suave */
  /* La animación solo se ejecuta si el panel está abierto (optimización CPU) */
  animation-name: none; 
}

.ia-panel-wrapper.ia-open .ia-particle {
  animation-name: ia-float;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

/* Tamaños, posiciones y velocidades aleatorias */
.ia-particle:nth-child(1) { left: 10%; width: 15px; height: 15px; animation-duration: 8s; animation-delay: 0s; }
.ia-particle:nth-child(2) { left: 25%; width: 25px; height: 25px; animation-duration: 12s; animation-delay: 2s; }
.ia-particle:nth-child(3) { left: 40%; width: 10px; height: 10px; animation-duration: 7s; animation-delay: 4s; }
.ia-particle:nth-child(4) { left: 55%; width: 20px; height: 20px; animation-duration: 10s; animation-delay: 1s; }
.ia-particle:nth-child(5) { left: 70%; width: 12px; height: 12px; animation-duration: 9s; animation-delay: 3s; }
.ia-particle:nth-child(6) { left: 85%; width: 18px; height: 18px; animation-duration: 11s; animation-delay: 5s; }
.ia-particle:nth-child(7) { left: 15%; width: 8px; height: 8px; animation-duration: 6s; animation-delay: 6s; }
.ia-particle:nth-child(8) { left: 50%; width: 22px; height: 22px; animation-duration: 14s; animation-delay: 0.5s; }
.ia-particle:nth-child(9) { left: 80%; width: 14px; height: 14px; animation-duration: 8.5s; animation-delay: 2.5s; }
.ia-particle:nth-child(10){ left: 35%; width: 16px; height: 16px; animation-duration: 13s; animation-delay: 7s; }

@keyframes ia-float {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  10% { opacity: 0.8; }
  80% { opacity: 0.6; }
  100% {
    transform: translateY(-120vh) scale(1.5);
    opacity: 0;
  }
}

/* ================================================
   PESTAÑAS IA
   ================================================ */
.ia-tabs {
  display: flex;
  position: relative;
  z-index: 1;
  padding: 0;
  gap: 0;
  border-bottom: 2px solid rgba(58, 40, 0, 0.15);
  background: rgba(0, 0, 0, 0.08);
}

.ia-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 4px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #5A3C00;
  opacity: 0.5;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  user-select: none;
}

.ia-tab:hover {
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.15);
}

.ia-tab.active {
  opacity: 1;
  border-bottom-color: #3A2800;
  background: rgba(255, 255, 255, 0.25);
}

.ia-tab-icon  { font-size: 20px; line-height: 1; }
.ia-tab-text  { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; }

/* --- NUEVOS ICONOS PNG EN PESTAÑAS IA --- */
.ia-tab-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1)); /* Le da un toque suave para que resalte en el amarillo */
}

/* ================================================
   PANELES DE CONTENIDO IA
   ================================================ */
.ia-tab-panel {
  display: none;
  flex: 1;
  overflow: hidden;
  position: relative;
  z-index: 1;
  flex-direction: column;
}

.ia-tab-panel.active { display: flex; }

/* ── Scroll de resultados ── */
.ia-results-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* ── Placeholder vacío ── */
.ia-placeholder {
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.ia-placeholder-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: ia-wobble 1.6s ease-in-out infinite;
}

/* --- NUEVOS ICONOS PNG GIGANTES EN EL CENTRO --- */
.ia-placeholder-img {
  width: 72px;        /* Tamaño grande */
  height: 72px;
  object-fit: contain;
  margin-bottom: 15px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15)); /* Sombra bonita para integrarlo con el fondo */
}

.ia-placeholder-title {
  font-size: 20px;
  font-weight: 800;
  color: #3A2800;
  margin: 0 0 8px;
}

.ia-placeholder-sub {
  font-size: 14px;
  color: #5A3C00;
  margin: 0;
  line-height: 1.5;
}

@keyframes ia-wobble {
  0%, 100% { transform: rotate(-6deg); }
  50%      { transform: rotate(6deg); }
}

/* ── "En construcción" (tabs 2-4) ── */
.ia-construction       { text-align: center; padding: 40px 20px; }
.ia-construction-icon  { font-size: 48px; margin-bottom: 16px; animation: ia-wobble 1.6s ease-in-out infinite; }
.ia-construction-title { font-size: 20px; font-weight: 800; color: #3A2800; margin: 0 0 8px; }
.ia-construction-sub   { font-size: 14px; color: #5A3C00; margin: 0; line-height: 1.5; }
.ia-construction-sub em { opacity: 0.7; font-size: 12px; }

/* ================================================
   CHAT INPUT
   ================================================ */
.ia-chat-input-wrapper {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.06);
  border-top: 1px solid rgba(58, 40, 0, 0.12);
}

.ia-chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fffde8;
  border: 2px solid rgba(58, 40, 0, 0.2);
  border-radius: 24px;
  padding: 6px 8px 6px 16px;
  transition: border-color 0.3s;
}

.ia-chat-input:focus-within { border-color: #c8a000; }

.ia-chat-input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #3A2800;
  padding: 6px 0;
}

.ia-chat-input input::placeholder { color: #9a8a5a; }
.ia-chat-input input:disabled { opacity: 0.5; }

.ia-chat-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #3A2800;
  color: #FFE033;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ia-chat-send:hover { background: #5A3C00; transform: scale(1.05); }
.ia-chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ================================================
   RESULTADOS IA — Tarjetas
   ================================================ */
.ia-search-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(58, 40, 0, 0.08);
  border-radius: 8px;
  font-size: 13px;
  color: #3A2800;
}

.ia-search-stats .search-total { font-size: 13px; }
.ia-search-stats .search-range { font-size: 12px; opacity: 0.7; }

.ia-result-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(58, 40, 0, 0.12);
  border-left: 4px solid #c8a000;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: background 0.2s, box-shadow 0.2s;
}

.ia-result-card:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(58, 40, 0, 0.1);
}

.ia-result-card .search-result-header { margin-bottom: 6px; }

.ia-result-ref { font-size: 14px; font-weight: 700; color: #8B6914; }

.ia-result-card .search-result-text {
  font-size: 14px;
  line-height: 1.65;
  color: #3A2800;
  margin: 0;
}

/* ================================================
   PAGINACIÓN IA
   ================================================ */
.ia-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 16px 0 8px;
  flex-wrap: wrap;
}

.ia-page-btn {
  padding: 8px 18px;
  border: 2px solid rgba(58, 40, 0, 0.2);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.6);
  color: #3A2800;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ia-page-btn:hover { background: rgba(255, 255, 255, 0.9); border-color: #c8a000; }

.ia-pagination .pagination-info { font-size: 13px; color: #5A3C00; font-weight: 600; }

/* ================================================
   LOADING
   ================================================ */
.ia-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.ia-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(58, 40, 0, 0.15);
  border-top-color: #c8a000;
  border-radius: 50%;
  animation: ia-spin 0.8s linear infinite;
  margin-bottom: 20px;
}

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

.ia-loading-text { font-size: 15px; font-weight: 600; color: #3A2800; margin: 0 0 6px; }
.ia-loading-sub { font-size: 13px; color: #5A3C00; opacity: 0.7; margin: 0; }

/* ================================================
   EMPTY / ERROR
   ================================================ */
.ia-empty,
.ia-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.ia-empty-icon, .ia-error-icon { font-size: 48px; margin-bottom: 16px; }
.ia-empty h3 { font-size: 18px; font-weight: 700; color: #3A2800; margin: 0 0 8px; }
.ia-empty p { font-size: 14px; color: #5A3C00; margin: 0 0 4px; }
.ia-error-text { font-size: 14px; color: #8B2500; font-weight: 600; margin: 0; line-height: 1.5; }

/* =====================================================
   COLORES DINÁMICOS DEL PANEL IA (AURAS DE PODER)
   ===================================================== */

/* 1. Definición de la energía para cada Skin */
:root, [data-skin="classic"] {
  --ia-bg-grad: linear-gradient(135deg, #D4AF37 0%, #AA7C11 100%);
  --ia-text-main: #2A1C00;
  --ia-text-muted: #5A4000;
  --ia-input-bg: #FDF8E7;
  --ia-btn-bg: #1B365D;
  --ia-btn-text: #D4AF37;
}

[data-skin="lavanda"] {
  --ia-bg-grad: linear-gradient(135deg, #A8B2E0 0%, #7B8DC4 100%);
  --ia-text-main: #1A1A30;
  --ia-text-muted: #3D4570;
  --ia-input-bg: #F3F5FC;
  --ia-btn-bg: #4A5A9A;
  --ia-btn-text: #FFFFFF;
}

[data-skin="scriptorium"] {
  --ia-bg-grad: linear-gradient(135deg, #C4A052 0%, #8B5A19 100%);
  --ia-text-main: #2A1500;
  --ia-text-muted: #502D00;
  --ia-input-bg: #F9F4E8;
  --ia-btn-bg: #1A3028;
  --ia-btn-text: #C4A052;
}

[data-skin="blossom"] {
  --ia-bg-grad: linear-gradient(135deg, #F8BBD0 0%, #D81B60 100%);
  --ia-text-main: #4A0020;
  --ia-text-muted: #80003A;
  --ia-input-bg: #FFF0F5;
  --ia-btn-bg: #6A0030;
  --ia-btn-text: #F8BBD0;
}

[data-skin="ocean"] {
  --ia-bg-grad: linear-gradient(135deg, #48CAE4 0%, #0077B6 100%);
  --ia-text-main: #002233;
  --ia-text-muted: #004A70;
  --ia-input-bg: #E8F8FA;
  --ia-btn-bg: #03045E;
  --ia-btn-text: #48CAE4;
}

[data-skin="sunset"] {
  --ia-bg-grad: linear-gradient(135deg, #F8A888 0%, #C060A0 100%);
  --ia-text-main: #2A0820;
  --ia-text-muted: #5A1840;
  --ia-input-bg: #FFF4F8;
  --ia-btn-bg: #4A3878;
  --ia-btn-text: #F8C8A8;
}

[data-skin="forest"] {
  --ia-bg-grad: linear-gradient(135deg, #A8E6CF 0%, #388E3C 100%); /* Verde menta a verde jardín */
  --ia-text-main: #0A2912;
  --ia-text-muted: #1B4D26;
  --ia-input-bg: #E8F5E9;
  --ia-btn-bg: #132A18;
  --ia-btn-text: #A8E6CF;
}

[data-skin="fire"] {
  --ia-bg-grad: linear-gradient(135deg, #FF7A00 0%, #C72213 100%);
  --ia-text-main: #3A0500;
  --ia-text-muted: #601000;
  --ia-input-bg: #FFF0E8;
  --ia-btn-bg: #2A1005;
  --ia-btn-text: #FF7A00;
}

/* 2. Aplicación Mágica (Sobreescribe el código superior automáticamente) */
.ia-panel { background: var(--ia-bg-grad); border-top: 3px solid rgba(255, 255, 255, 0.4); }
.ia-tab { color: var(--ia-text-muted); }
.ia-tab.active { border-bottom-color: var(--ia-text-main); }
.ia-placeholder-title, .ia-construction-title, .ia-empty h3 { color: var(--ia-text-main); }
.ia-placeholder-sub, .ia-construction-sub, .ia-empty p, .ia-loading-sub { color: var(--ia-text-muted); }
.ia-chat-input { background: var(--ia-input-bg); border-color: rgba(0, 0, 0, 0.15); }
.ia-chat-input:focus-within { border-color: var(--ia-btn-bg); }
.ia-chat-input input { color: var(--ia-text-main); }
.ia-chat-input input::placeholder { color: var(--ia-text-muted); opacity: 0.7; }
.ia-chat-send { background: var(--ia-btn-bg); color: var(--ia-btn-text); }
.ia-chat-send:hover { background: var(--ia-text-main); }
.ia-search-stats, .ia-result-card .search-result-text, .ia-page-btn, .ia-loading-text { color: var(--ia-text-main); }
.ia-result-ref { color: var(--ia-btn-bg); }
.ia-page-btn { border-color: rgba(0, 0, 0, 0.15); }
.ia-page-btn:hover { border-color: var(--ia-btn-bg); background: rgba(255, 255, 255, 0.8); }
