/* ═══════════════════════════════════════════════════════════
   BRAND COLORS — cambia estos valores para ajustar al tema
   ═══════════════════════════════════════════════════════════ */
:root {
  --brand-header-bg:   rgba(1, 11, 23, 0.6);
  --brand-header-border: rgba(255,255,255,.07);
  --brand-logo-primary: #ffffff;
  --brand-logo-accent:  #3b82f6;
  --brand-accent:       #3b82f6;
  --brand-accent-dim:   #1d4ed8;
  --brand-nav-active:   #3b82f6;
}

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

:root {
  /* --bg:        #080b12; */
  /* --bg:        rgba(1, 11, 23, 0.6); */
  --surface:   #0e1320;
  /* --card:      #111827; */
  --card:      rgba(1, 11, 23, 0.95);
  --border:    #1c2a45;
  --border-hi: #2a3f66;
  --text:      #e2e8f0;
  --text-2:    #94a3b8;
  --text-3:    #4a5568;
  --green:     #22c55e;
  --red:       #ef4444;
  --orange:    #f59e0b;
  --radius:    10px;
  --header-h:  52px;
  --grid-pad:  16px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

body {
  background: url(https://whispr.news/wp-content/uploads/2024/05/16406299_rm373batch2-08.jpg) no-repeat center center;
  background-size: cover;
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 2px; }

/* ── Header ──────────────────────────────────────────────────── */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  /* background: var(--brand-header-bg); */
  background: rgba(1, 11, 23, 0.7)!important;
  border-bottom: 1px solid var(--brand-header-border);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
}

.header-logo {
  display: flex; align-items: baseline; gap: 5px;
  text-decoration: none;
  background: url(https://whispr.news/wp-content/uploads/2024/06/wghispr-news-360.png) no-repeat center center;
  background-size: cover;
  text-indent: -50000px;
  min-width: 100px;
  min-height: 30px;
}
.logo-text {
  font-size: 16px; font-weight: 700; letter-spacing: 2px;
  color: var(--brand-logo-primary);
}
.logo-live {
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  color: var(--brand-logo-accent);
  text-transform: uppercase;
}

.live-dot {
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.3} }

.header-nav {
  display: flex; gap: 4px; margin-left: 8px;
}
.header-nav-link {
  font-size: 13px; color: var(--text-3);
  padding: 4px 10px; border-radius: 6px;
  transition: color .15s, background .15s;
}
.header-nav-link:hover { color: var(--text-2); }
.header-nav-link.active { color: var(--brand-nav-active); background: rgba(59,130,246,.1); }

.header-spacer { flex: 1; }

.conn-status { font-size: 11px; color: var(--text-3); }
.conn-status.connected { color: var(--green); }

#btn-add-widget {
  display: flex; align-items: center; gap: 6px;
  background: var(--brand-accent-dim); border: none;
  color: #fff; padding: 6px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .15s;
}
#btn-add-widget:hover { background: var(--brand-accent); }

/* ── Gridstack overrides ─────────────────────────────────────── */
.grid-stack {
  margin-top: var(--header-h);
  padding: var(--grid-pad);
  background: transparent;
}

.grid-stack-item-content {
  border-radius: var(--radius);
  overflow: hidden;
  inset: 4px !important;          /* gap entre widgets */
}

/* Placeholder mientras se arrastra */
.grid-stack-placeholder > .placeholder-content {
  background: rgba(59,130,246,.08);
  border: 2px dashed var(--border-hi);
  border-radius: var(--radius);
}

/* Handle resize */
.ui-resizable-se {
  width: 14px; height: 14px;
  right: 6px; bottom: 6px;
  background: var(--border-hi);
  border-radius: 2px;
  opacity: 0;
  transition: opacity .2s;
}
.grid-stack-item:hover .ui-resizable-se { opacity: 1; }

/* ── Widget card ─────────────────────────────────────────────── */
.widget {
  height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: border-color .2s;
}
.widget:hover { border-color: var(--border-hi); }

.widget-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  cursor: grab;
}
.widget-header:active { cursor: grabbing; }

.wh-icon { font-size: 15px; }
.wh-title { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.wh-btn {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; padding: 2px 5px; border-radius: 4px;
  font-size: 13px; line-height: 1;
  transition: color .15s, background .15s;
}
.wh-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }

.widget-search {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.widget-search input {
  width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  padding: 5px 10px; font-size: 12px; outline: none;
  transition: border-color .15s;
}
.widget-search input:focus { border-color: var(--brand-accent); }
.widget-search input::placeholder { color: var(--text-3); }

.widget-body { flex: 1; overflow-y: auto; padding: 4px 0; }

.widget-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: center; flex-shrink: 0;
}
.btn-load-more {
  background: none; border: 1px solid var(--border);
  color: var(--text-2); padding: 4px 16px;
  border-radius: 6px; font-size: 12px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-load-more:hover { border-color: var(--brand-accent); color: var(--brand-accent); }

/* ── News item ───────────────────────────────────────────────── */
.news-item {
  display: flex; gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  cursor: default;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: rgba(255,255,255,.02); }
.news-item[style*="cursor:pointer"]:hover { background: rgba(59,130,246,.05); }
.news-item.is-new { animation: flash-new .8s ease; }
@keyframes flash-new { 0%{background:rgba(34,197,94,.14)} 100%{background:transparent} }

.ni-img-wrap { flex-shrink: 0; }
.ni-thumb {
  width: 90px; height: 62px;
  border-radius: 6px; object-fit: cover;
  display: block; background: var(--surface);
}
.ni-thumb-placeholder {
  width: 90px; height: 62px; flex-shrink: 0;
  border-radius: 6px; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.ni-body { flex: 1; min-width: 0; }
.ni-title {
  font-size: 12.5px; font-weight: 500; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ni-excerpt {
  font-size: 11.5px; color: var(--text-2); line-height: 1.4; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ni-meta { display: flex; align-items: center; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.ni-time { font-size: 11px; color: var(--text-3); }

.ni-tier { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.ni-tier-1 { background:rgba(239,68,68,.15);  color:var(--red); }
.ni-tier-2 { background:rgba(245,158,11,.15); color:var(--orange); }
.ni-tier-3 { background:rgba(34,197,94,.15);  color:var(--green); }
.ni-tier-4 { background:rgba(148,163,184,.1); color:var(--text-3); }

.ni-platforms { display:flex; gap:3px; margin-left:auto; }
.ni-platform-badge {
  font-size: 10px; padding: 1px 5px; border-radius: 3px;
  background: rgba(59,130,246,.12); color: var(--brand-accent);
}
.ni-wp-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 3px;
  background: rgba(34,197,94,.12); color: var(--green); font-weight: 600;
}

/* ── Ticker ──────────────────────────────────────────────────── */
.ticker-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
.ticker-row:last-child { border-bottom: none; }

.tr-symbol { width: 44px; font-size: 12px; font-weight: 700; }
.tr-price  {
  flex: 1; font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: color .25s;
}
.tr-price.flash-up   { color: var(--green); }
.tr-price.flash-down { color: var(--red); }
.tr-change {
  font-size: 12px; font-weight: 500;
  min-width: 54px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.tr-change.up   { color: var(--green); }
.tr-change.down { color: var(--red); }
.tr-arrow       { font-size: 11px; width: 12px; }
.tr-arrow.up    { color: var(--green); }
.tr-arrow.down  { color: var(--red); }

/* ── Clusters ────────────────────────────────────────────────── */
.cluster-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.cluster-item:last-child { border-bottom: none; }
.cluster-item:hover { background: rgba(59,130,246,.05); }

.ci-rank  { width: 20px; font-size: 11px; color: var(--text-3); text-align: center; flex-shrink: 0; padding-top: 2px; }
.ci-body  { flex: 1; min-width: 0; }
.ci-label {
  font-size: 12.5px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ci-keywords {
  font-size: 11px; color: var(--text-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ci-count {
  font-size: 11px; font-weight: 600; color: var(--brand-accent);
  background: rgba(59,130,246,.1); padding: 2px 7px;
  border-radius: 10px; flex-shrink: 0;
}

/* ── States ──────────────────────────────────────────────────── */
.widget-empty   { padding:28px 16px; text-align:center; color:var(--text-3); font-size:13px; }
.widget-loading { padding:20px 16px; text-align:center; color:var(--text-3); font-size:12px; }
.spinner {
  display:inline-block; width:14px; height:14px;
  border:2px solid var(--border); border-top-color:var(--brand-accent);
  border-radius:50%; animation:spin .7s linear infinite;
  vertical-align:middle; margin-right:6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ───────────────────────────────────────────────────── */
#modal-overlay {
  position:fixed; inset:0; z-index:200;
  background:rgba(0,0,0,.65);
  display:none; align-items:center; justify-content:center;
}
#modal-overlay.open { display:flex; }

#modal {
  background:var(--card); border:1px solid var(--border-hi);
  border-radius:var(--radius); padding:24px;
  width:370px; max-width:92vw;
}
#modal h2 { font-size:15px; margin-bottom:16px; }

.modal-type-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:16px; }
.modal-type-btn {
  background:var(--surface); border:1px solid var(--border);
  color:var(--text-2); padding:12px 8px; border-radius:8px;
  cursor:pointer; text-align:center; font-size:12px; transition:all .15s;
}
.modal-type-btn:hover,
.modal-type-btn.active {
  border-color:var(--brand-accent); color:var(--brand-accent);
  background:rgba(59,130,246,.08);
}
.mbt-icon { font-size:20px; display:block; margin-bottom:4px; }

#modal-keywords-row { display:none; margin-bottom:16px; }
#modal-keywords-row.show { display:block; }
#modal-keywords-row label { font-size:12px; color:var(--text-2); display:block; margin-bottom:5px; }
#modal-keywords-row input {
  width:100%; background:var(--surface); border:1px solid var(--border);
  border-radius:6px; color:var(--text); padding:7px 10px;
  font-size:13px; outline:none;
}
#modal-keywords-row input:focus { border-color:var(--brand-accent); }

.modal-actions { display:flex; gap:8px; justify-content:flex-end; }
.btn-modal-cancel {
  background:none; border:1px solid var(--border);
  color:var(--text-2); padding:7px 16px; border-radius:6px;
  cursor:pointer; font-size:13px;
}
.btn-modal-ok {
  background:var(--brand-accent-dim); border:none;
  color:#fff; padding:7px 16px; border-radius:6px;
  cursor:pointer; font-size:13px; font-weight:500;
}
.btn-modal-ok:hover { background:var(--brand-accent); }

/* ── Web queue widget ────────────────────────────────────────── */
.wq-item {
  display: flex; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  transition: opacity .2s;
}
.wq-item:last-child { border-bottom: none; }

.wq-img-wrap { flex-shrink: 0; }
.wq-thumb {
  width: 100px; height: 68px;
  border-radius: 6px; object-fit: cover;
  display: block; background: var(--surface);
}
.wq-thumb-placeholder {
  width: 100px; height: 68px;
  border-radius: 6px; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}

.wq-body    { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wq-title   { font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--text);
               display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wq-excerpt { font-size: 11.5px; color: var(--text-2); line-height: 1.4;
               display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wq-reason  { font-size: 11px; color: var(--text-3); font-style: italic; }

.wq-actions { display: flex; align-items: center; gap: 6px; margin-top: 2px; }

.wq-btn {
  border: none; border-radius: 5px; padding: 3px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: opacity .15s;
}
.wq-btn:hover { opacity: .85; }
.wq-approve { background: rgba(34,197,94,.18);  color: var(--green); }
.wq-reject  { background: rgba(239,68,68,.15);  color: var(--red); }

/* ── Calendar widget ─────────────────────────────────────────── */
.cal-day-header {
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: var(--text-3); text-transform: uppercase;
  padding: 8px 14px 4px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1;
}

.cal-event {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 7px 14px; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.cal-event:last-child { border-bottom: none; }
.cal-event:hover { background: rgba(59,130,246,.04); }
.cal-event.cal-released { opacity: .55; }
.cal-event.cal-imminent { background: rgba(245,158,11,.05); border-left: 2px solid var(--orange); }

.cal-time {
  font-size: 11px; color: var(--text-3); min-width: 38px;
  font-variant-numeric: tabular-nums; flex-shrink: 0; padding-top: 1px;
}
.cal-event.cal-imminent .cal-time { color: var(--orange); font-weight: 600; }

.cal-body  { flex: 1; min-width: 0; }
.cal-name  { font-size: 12px; font-weight: 500; line-height: 1.3; color: var(--text); }
.cal-meta  { display: flex; align-items: center; gap: 5px; margin-top: 3px; flex-wrap: wrap; }
.cal-currency { font-size: 10px; font-weight: 700; color: var(--text-3); }
.cal-imp-1 { font-size: 10px; color: var(--text-3); }
.cal-imp-2 { font-size: 10px; color: var(--orange); }
.cal-imp-3 { font-size: 10px; color: var(--red); }
.cal-actual   { font-size: 11px; font-weight: 700; color: var(--green); }
.cal-forecast { font-size: 10px; color: var(--text-3); }

/* ── TV widget ───────────────────────────────────────────────── */
.tv-tabs {
  display: flex;
  gap: 2px;
  padding: 5px 6px 4px;
  flex-wrap: wrap;
  background: rgba(0,0,0,.2);
  flex-shrink: 0;
}
.tv-tab {
  background: rgba(255,255,255,.07);
  border: none;
  border-radius: 4px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.tv-tab:hover  { background: rgba(255,255,255,.14); color: var(--text); }
.tv-tab.active { background: var(--brand-accent); color: #fff; }
.tv-iframe {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .grid-stack { padding: 8px; }
  .header-nav { display: none; }
}
