
/* ══════════════════════════════════════════════════════════════════════════
   NUEVAS FUNCIONES — WebNewsBot · AudioEditor · Efemérides
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Cards nuevas ─────────────────────────────────────────────────────── */

.home-section--tools .option-card--tool {
  border-top: 3px solid #7c3aed;
}
.home-section--tools .option-card--tool:hover {
  border-color: #7c3aed;
  box-shadow: 0 0 0 1px #7c3aed44, var(--shadow-md);
}
.option-card--ai {
  border-top: 3px solid #0ea5e9;
}
.option-card--ai:hover {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 1px #0ea5e944, var(--shadow-md);
}

/* ── Banner efemérides ────────────────────────────────────────────────── */

.efemerides-banner {
  margin: 0 0 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.efem-banner-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .875rem;
  line-height: 1.4;
}
.efem-today    { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); }
.efem-tomorrow { background: rgba(234,179,8,.1);  border: 1px solid rgba(234,179,8,.3); }
.efem-banner-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.efem-banner-body  { display: flex; flex-direction: column; gap: 2px; }
.efem-banner-body strong { font-size: .9rem; }
.efem-banner-when  { font-size: .75rem; font-weight: 600; opacity: .7; letter-spacing: .04em; }
.efem-banner-notes { font-size: .8rem; opacity: .65; }

/* ── Modal efemérides ─────────────────────────────────────────────────── */

.efem-modal {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
}
.efem-modal.hidden { display: none; }
.efem-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
}
.efem-modal-card {
  position: relative; z-index: 1;
  background: var(--surface);
  border-radius: 16px;
  width: min(560px, 96vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 20px;
}
.efem-modal-header {
  display: flex; align-items: center; justify-content: space-between;
}
.efem-modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.efem-modal-header button {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--txt-3); padding: 4px 8px;
}
.efem-form {
  background: var(--surface-2);
  border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.efem-form-title { font-size: .85rem; font-weight: 600; color: var(--txt-2); margin: 0 0 4px; }
.efem-form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.efem-field-date input { width: 160px; }
.efem-form-actions {
  display: flex; justify-content: flex-end; gap: 8px; align-items: center;
}
.efem-list-heading { font-size: .85rem; font-weight: 600; color: var(--txt-2); margin: 0 0 8px; }
.efem-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.efem-list-empty { font-size: .875rem; color: var(--txt-3); padding: 8px 0; }
.efem-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2); border-radius: 8px;
}
.efem-list-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.efem-list-date  { font-size: .75rem; font-weight: 700; color: var(--accent); }
.efem-list-label { font-size: .9rem; font-weight: 500; }
.efem-list-notes { font-size: .78rem; color: var(--txt-3); }
.efem-list-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── WebNewsBot ───────────────────────────────────────────────────────── */

.webnews-screen { padding: 16px; max-width: 1200px; margin: 0 auto; }
.webnews-hint {
  font-size: .8rem; color: var(--txt-3); margin: -6px 0 6px;
  line-height: 1.4;
}
.webnews-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  align-items: start;
  margin-top: 12px;
}
@media (max-width: 900px) {
  .webnews-layout { grid-template-columns: 1fr; }
}
.webnews-input-panel,
.webnews-output-panel { min-width: 0; }

.webnews-output-section { display: flex; flex-direction: column; min-height: 300px; }
.webnews-output-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.webnews-output-actions { display: flex; gap: 6px; }

.webnews-output {
  flex: 1;
  min-height: 280px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 10px;
  font-size: .875rem;
  line-height: 1.7;
  color: var(--txt-2);
  word-break: break-word;
  border: 1px solid var(--border);
}
.webnews-output.has-content { color: var(--txt-1); }
.webnews-output.has-error   { color: #ef4444; }
.wn-section-label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--accent);
  margin-top: 14px;
  margin-bottom: 2px;
}
.webnews-char-count {
  font-size: .75rem; color: var(--txt-3); margin-top: 6px; text-align: right;
}
.webnews-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-top: 4px;
}
.wn-generate-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 10px 20px; font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: background .2s, opacity .2s;
}
.wn-generate-btn:hover:not(:disabled) { background: var(--accent-hover); }
.wn-generate-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── AudioEditor ──────────────────────────────────────────────────────── */

.audio-editor-screen { padding: 16px; max-width: 720px; margin: 0 auto; }

.audio-tabs {
  display: flex; gap: 4px;
  background: var(--surface-2);
  border-radius: 10px; padding: 4px;
  margin-bottom: 16px;
}
.audio-tab {
  flex: 1;
  padding: 9px 14px;
  border: none; border-radius: 7px;
  background: transparent; color: var(--txt-2);
  font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s;
}
.audio-tab.active {
  background: var(--surface);
  color: var(--txt-1);
  box-shadow: var(--shadow-sm);
}
.audio-tab:hover:not(.active) { background: var(--surface); }

.audio-tab-panel.hidden { display: none; }

.audio-panel {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.audio-panel-desc {
  font-size: .85rem; color: var(--txt-3); line-height: 1.5; margin: 0;
}

.audio-dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.audio-dropzone:hover, .audio-dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(220,38,38,.04);
}
.audio-dropzone.has-file { border-style: solid; border-color: var(--accent); }
.audio-drop-icon { font-size: 2rem; }
.audio-drop-text { font-size: .9rem; color: var(--txt-2); margin: 0; }
.audio-drop-text strong { color: var(--accent); }
.audio-drop-hint { font-size: .75rem; color: var(--txt-3); margin: 0; }

.audio-file-info {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: 8px; padding: 8px 12px;
  font-size: .875rem;
}
.audio-file-icon { flex-shrink: 0; }
.audio-file-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-file-remove {
  background: none; border: none; cursor: pointer;
  color: var(--txt-3); font-size: 1rem; padding: 2px 4px;
}

.audio-params { display: flex; flex-direction: column; gap: 12px; }
.audio-param-group { display: flex; flex-direction: column; gap: 6px; }
.audio-param-label {
  font-size: .82rem; color: var(--txt-2); font-weight: 500;
  display: flex; justify-content: space-between;
}
.audio-param-val { color: var(--accent); font-weight: 700; }
.audio-range {
  width: 100%; accent-color: var(--accent);
  height: 4px; cursor: pointer;
}

.audio-actions { display: flex; justify-content: flex-end; }
.audio-process-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 10px 24px; font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: background .2s, opacity .2s;
}
.audio-process-btn:hover:not(:disabled) { background: var(--accent-hover); }
.audio-process-btn:disabled { opacity: .5; cursor: not-allowed; }

.audio-progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.audio-progress-bar {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.audio-progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 4px; transition: width .3s ease;
}
.audio-progress-text { font-size: .8rem; color: var(--txt-3); text-align: center; margin: 0; }

.audio-result {
  display: flex; align-items: center; gap: 10px;
  background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3);
  border-radius: 8px; padding: 10px 14px;
}
.audio-result-icon { font-size: 1.1rem; }
.audio-result-label { flex: 1; font-size: .875rem; font-weight: 500; }

.join-file-list { display: flex; flex-direction: column; gap: 8px; }
.join-list-header {
  display: flex; align-items: center; justify-content: space-between;
}
.join-list-title { font-size: .85rem; font-weight: 600; color: var(--txt-2); }
.join-files-ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.join-file-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: 8px;
  padding: 8px 10px; font-size: .85rem;
}
.join-file-idx {
  width: 20px; text-align: center;
  font-size: .75rem; font-weight: 700; color: var(--txt-3);
}
.join-file-icon { flex-shrink: 0; }
.join-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.join-file-size  { font-size: .75rem; color: var(--txt-3); flex-shrink: 0; }
.join-file-btns  { display: flex; gap: 4px; flex-shrink: 0; }
.join-move-btn, .join-remove-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px;
  font-size: .8rem; cursor: pointer; color: var(--txt-2);
  transition: background .15s;
}
.join-move-btn:hover   { background: var(--surface-2); }
.join-remove-btn       { color: #ef4444; border-color: rgba(239,68,68,.3); }
.join-remove-btn:hover { background: rgba(239,68,68,.08); }
.join-move-placeholder { display: inline-block; width: 30px; }

/* ══════════════════════════════════════════════════════════════════════════
   AUDIO EDITOR AVANZADO
   ══════════════════════════════════════════════════════════════════════════ */

.ae-screen { padding: 0 16px 24px; max-width: 960px; margin: 0 auto; }

/* ── Workspace ── */
.ae-workspace { display: flex; flex-direction: column; gap: 10px; }

.ae-file-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border-radius: 8px;
  padding: 8px 12px; font-size: .875rem;
}
.ae-file-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Waveform ── */
.ae-waveform-wrap {
  position: relative;
  background: #0b1120;
  border-radius: 10px;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
  border: 1px solid rgba(255,255,255,.07);
}
.ae-waveform-wrap canvas {
  display: block;
  width: 100%;
}

/* Ruler */
.ae-ruler {
  position: relative; height: 18px;
  background: rgba(0,0,0,.4);
  overflow: hidden;
}
.ae-ruler-mark {
  position: absolute;
  top: 2px;
  font-size: .65rem;
  color: rgba(255,255,255,.4);
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ── Playback bar ── */
.ae-playback {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border-radius: 10px;
  padding: 10px 14px;
  flex-wrap: wrap;
}
.ae-pb-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 13px;
  font-size: 1rem; cursor: pointer; color: var(--txt-1);
  transition: background .15s;
}
.ae-pb-btn:hover { background: var(--surface-2, #1e293b); }
.ae-play-btn {
  background: var(--accent); color: #fff; border-color: var(--accent);
  min-width: 44px;
}
.ae-play-btn:hover { background: var(--accent-hover); }

.ae-time-display {
  font-size: .9rem; font-variant-numeric: tabular-nums;
  color: var(--txt-1); font-weight: 600; letter-spacing: .03em;
}
.ae-time-sep { color: var(--txt-3); }

.ae-vol-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .85rem; color: var(--txt-2); margin-left: auto;
  cursor: default;
}
.ae-vol-range { width: 80px; }
#ae-vol-pct { font-size: .78rem; color: var(--txt-3); min-width: 38px; }

/* ── Selection info ── */
.ae-sel-info {
  font-size: .8rem; color: var(--accent);
  background: rgba(99,102,241,.1); border-radius: 6px;
  padding: 5px 10px; text-align: center; font-weight: 600;
}

/* ── Edit toolbar ── */
.ae-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: var(--surface-2); border-radius: 10px;
  padding: 10px 12px; align-items: center;
}
.ae-tool-group {
  display: flex; align-items: center; gap: 5px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}
.ae-tool-group:last-child { border-right: none; padding-right: 0; }
.ae-tool-group-end { margin-left: auto; border-right: none; }
.ae-group-label {
  font-size: .72rem; font-weight: 700; color: var(--txt-3);
  letter-spacing: .06em; text-transform: uppercase;
  margin-right: 2px;
}
.ae-tool-btn {
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--txt-2);
  font-size: .82rem; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.ae-tool-btn:hover:not(:disabled) {
  background: var(--surface-2); color: var(--txt-1);
  border-color: var(--accent);
}
.ae-tool-btn:disabled { opacity: .4; cursor: not-allowed; }
.ae-tool-danger { border-color: rgba(239,68,68,.35); color: #ef4444; }
.ae-tool-danger:hover:not(:disabled) {
  background: rgba(239,68,68,.08); border-color: #ef4444;
}

/* ── Generic panel ── */
.ae-panel {
  background: var(--surface-2); border-radius: 10px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.ae-panel-header {
  display: flex; align-items: center; justify-content: space-between;
}
.ae-panel-title {
  font-size: .85rem; font-weight: 700; color: var(--txt-2);
}

/* ── Silence panel ── */
.ae-silence-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 5px;
  max-height: 200px; overflow-y: auto;
}
.ae-silence-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 7px;
  padding: 7px 10px; font-size: .83rem;
}
.ae-sil-time { flex: 1; font-variant-numeric: tabular-nums; font-weight: 500; }
.ae-sil-dur  { color: #eab308; font-weight: 700; font-size: .78rem; }
.ae-sil-btns { display: flex; gap: 5px; }

/* ── AI section ── */
.ae-ai-section { display: flex; flex-direction: column; gap: 10px; }
.ae-ai-tools {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.ae-ai-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--txt-2);
  font-size: .875rem; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ae-ai-btn:hover { background: var(--surface-2); border-color: var(--accent); color: var(--txt-1); }

.ae-ai-output {
  background: var(--surface); border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.ae-ai-output-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.ae-ai-output-body {
  padding: 12px; font-size: .85rem; line-height: 1.7;
  color: var(--txt-1); max-height: 260px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}

/* ── Export section ── */
.ae-export-section { display: flex; flex-direction: column; gap: 8px; }
.ae-export-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ae-format-select {
  padding: 8px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--txt-1); font-size: .85rem; flex: 1; min-width: 180px;
}
.ae-export-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 20px; font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: background .2s, opacity .2s;
}
.ae-export-btn:hover:not(:disabled) { background: var(--accent-hover); }
.ae-export-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .ae-toolbar { gap: 6px; }
  .ae-tool-group { padding-right: 8px; }
  .ae-playback { gap: 6px; }
  .ae-vol-label { display: none; }
}
