/* ─── RL Resumen IA — Estilos ───────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* Widget Container */
.rl-resumen-widget {
  --rl-accent:   #C8102E;
  --rl-dark:     #111111;
  --rl-mid:      #2a2a2a;
  --rl-light:    #f5f2ee;
  --rl-border:   #e2ddd8;
  --rl-text:     #333333;
  --rl-muted:    #888888;
  --rl-white:    #ffffff;

  font-family: 'Sora', sans-serif;
  position: relative;
  background: var(--rl-light);
  border-left: 4px solid var(--rl-accent);
  border-radius: 0 12px 12px 0;
  padding: 0;
  margin: 2rem 0 2.5rem;
  overflow: hidden;
  box-shadow: 0 2px 20px rgba(0,0,0,0.07);
}

/* Header */
.rl-resumen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--rl-dark);
  color: var(--rl-white);
  padding: 12px 20px;
}

.rl-resumen-icon {
  color: var(--rl-accent);
  font-size: 1.1rem;
  line-height: 1;
  animation: rl-pulse 2.5s ease-in-out infinite;
}

@keyframes rl-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.rl-resumen-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rl-white);
}

.rl-resumen-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--rl-accent);
  color: var(--rl-white);
  padding: 3px 9px;
  border-radius: 20px;
}

/* Body */
.rl-resumen-body {
  padding: 20px 22px 4px;
  min-height: 60px;
}

.rl-resumen-text {
  font-family: 'Lora', serif;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--rl-text);
  margin: 0;
  display: none;
}

/* Loading dots */
.rl-resumen-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0 16px;
}

.rl-loading-label {
  font-size: 0.78rem;
  color: var(--rl-muted);
  margin-left: 4px;
}

.rl-dot {
  width: 7px;
  height: 7px;
  background: var(--rl-accent);
  border-radius: 50%;
  display: inline-block;
  animation: rl-bounce 1.2s infinite ease-in-out;
}
.rl-dot:nth-child(2) { animation-delay: 0.2s; }
.rl-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes rl-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* Actions */
.rl-resumen-actions {
  display: flex;
  gap: 8px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--rl-border);
  flex-wrap: wrap;
}

/* Buttons */
.rl-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Sora', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.rl-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.rl-btn-copy {
  background: var(--rl-dark);
  color: var(--rl-white);
}
.rl-btn-copy:hover {
  background: var(--rl-mid);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.rl-btn-copy.rl-copied {
  background: #27ae60;
}

.rl-btn-tts {
  background: var(--rl-accent);
  color: var(--rl-white);
}
.rl-btn-tts:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200,16,46,0.3);
}
.rl-btn-tts.rl-speaking {
  animation: rl-speaking-pulse 1s infinite;
}

@keyframes rl-speaking-pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(200,16,46,0.5); }
  50%       { box-shadow: 0 0 0 8px rgba(200,16,46,0); }
}

.rl-btn-expand {
  background: transparent;
  color: var(--rl-muted);
  border: 1.5px solid var(--rl-border);
}
.rl-btn-expand:hover {
  border-color: var(--rl-dark);
  color: var(--rl-dark);
  transform: translateY(-1px);
}

/* Error state */
.rl-resumen-error {
  font-size: 0.82rem;
  color: var(--rl-accent);
  padding: 4px 0 12px;
  display: none;
}

/* ─── Modal ──────────────────────────────────────────────────────────────────── */

.rl-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(4px);
  z-index: 999999;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 540px) {
  .rl-modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

.rl-modal-overlay.rl-open {
  display: flex;
  animation: rl-fade-in 0.25s ease;
}

@keyframes rl-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.rl-modal {
  background: var(--rl-white, #fff);
  border-radius: 16px 16px 0 0;
  max-width: 620px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.3);
  animation: rl-slide-up 0.3s ease;
  font-family: 'Sora', sans-serif;
  box-sizing: border-box;
}

@media (min-width: 540px) {
  .rl-modal {
    border-radius: 16px;
    max-height: 90vh;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  }
}

@keyframes rl-slide-up {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.rl-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #111;
  padding: 22px 24px;
  color: #fff;
}

.rl-modal-icon {
  color: #C8102E;
  font-size: 1.2rem;
  margin-top: 3px;
  flex-shrink: 0;
}

.rl-modal-header h2 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  margin: 0;
  flex: 1;
}

.rl-modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-top: -2px;
  transition: color 0.2s;
}
.rl-modal-close:hover { color: #fff; }

.rl-modal-body {
  padding: 28px 28px 20px;
}

.rl-modal-subtitle {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aaa;
  margin: 0 0 18px;
}

.rl-modal-text {
  font-family: 'Lora', serif;
  font-size: 1.1rem;
  line-height: 1.85;
  color: #222;
  border-left: 3px solid #C8102E;
  margin: 0;
  padding: 4px 0 4px 20px;
  font-style: italic;
}

.rl-modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 28px 24px;
  border-top: 1px solid #eee;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 539px) {
  .rl-resumen-actions { gap: 6px; }
  .rl-btn span { display: none; }
  .rl-btn { padding: 9px 12px; }

  .rl-modal-header { padding: 16px 18px; }
  .rl-modal-header h2 { font-size: 0.9rem; }
  .rl-modal-body { padding: 20px 18px 14px; }
  .rl-modal-text { font-size: 0.95rem; line-height: 1.7; }
  .rl-modal-footer {
    padding: 12px 18px 20px;
    flex-direction: column;
  }
  .rl-modal-footer .rl-btn { width: 100%; justify-content: center; }
}
