/*
Theme Name: MicroStock Live
Theme URI: https://example.com/
Description: News theme for micro-cap & penny stock sites. Every live RSS feed in its own box, 4 per line, a live news list with filters on the right, header links to news sites, 60-second auto refresh. RSS fetching and settings are built in (no plugin needed).
Version: 2.4.0
Author: You
Requires PHP: 7.4
Text Domain: microstock-live
*/

:root{--bg:#f4f6f8;--card:#fff;--ink:#111827;--muted:#6b7280;--line:#e5e7eb;--brand:#0a7d3c;--dark:#0f172a;--red:#dc2626;--amber:#d97706}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}
a{color:var(--brand)}
img{max-width:100%;height:auto}

/* header */
.site-header{background:var(--dark);color:#fff}
.site-top{max-width:1400px;margin:0 auto;padding:14px 20px;display:flex;flex-wrap:wrap;gap:12px;align-items:center}
.site-title{margin:0;font-size:22px;font-weight:800;letter-spacing:.2px}
.site-title a{color:#fff;text-decoration:none}
.site-links{max-width:1400px;margin:0 auto;padding:0 20px 12px;display:flex;flex-wrap:wrap;gap:8px}
.site-links a{padding:5px 12px;border-radius:999px;background:#1e293b;color:#e2e8f0;text-decoration:none;font-size:13px;font-weight:600}
.site-links a:hover{background:var(--brand);color:#fff}
.site-links .lbl{align-self:center;font-size:12px;color:#94a3b8;margin-right:4px}
.main-nav ul{list-style:none;margin:0;padding:0;display:flex;gap:16px}
.main-nav a{color:#cbd5e1;text-decoration:none;font-weight:600}
.main-nav a:hover{color:#fff}

/* layout: content left, live feed right */
.layout{max-width:1400px;margin:20px auto;padding:0 20px;display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:20px;align-items:start}
.content .card,.content article{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:18px 22px;margin-bottom:18px}
.content h1,.content h2{line-height:1.25}
.entry-title a{color:var(--ink);text-decoration:none}

/* live sidebar */
.live{position:sticky;top:12px;background:var(--card);border:1px solid var(--line);border-radius:10px;display:flex;flex-direction:column;max-height:calc(100vh - 24px)}
.live-head{display:flex;justify-content:space-between;align-items:baseline;padding:12px 14px 6px}
.live-head h2{margin:0;font-size:17px}
.live-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:var(--brand);margin-right:6px;animation:pulse 1.6s infinite}
@keyframes pulse{50%{opacity:.25}}
#live-status{font-size:12px;color:var(--muted)}
.live-tabs{display:flex;gap:6px;padding:4px 14px 10px}
.live-tabs{flex-wrap:wrap}
.live-tabs button{flex:1 1 30%;padding:6px 4px;border:1px solid var(--line);border-radius:6px;background:#f9fafb;font:600 12px system-ui;cursor:pointer}
.live-tabs button.on{background:var(--dark);color:#fff;border-color:var(--dark)}
.live-tabs .n{opacity:.7;font-weight:500}
.live-filters{border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:8px 14px;font-size:13px}
.live-filters summary{cursor:pointer;font-weight:700}
.live-filters input[type=search],.live-filters select{width:100%;margin:8px 0 0;padding:7px 9px;border:1px solid var(--line);border-radius:6px;font:inherit}
.live-sources{display:flex;flex-wrap:wrap;gap:6px 12px;margin-top:8px}
.live-sources label,.live-filters .opt{display:flex;gap:5px;align-items:center}
.live-filters .opt{margin-top:8px}
.live-btn{margin-top:8px;padding:7px 10px;border:0;border-radius:6px;background:var(--brand);color:#fff;font-weight:700;cursor:pointer}
.live-btn:disabled{background:#6b7280;cursor:default}
.live-reset{background:none;border:0;color:var(--muted);text-decoration:underline;cursor:pointer;font-size:12px;margin-left:8px}
.live-body{list-style:none;margin:0;padding:0;overflow-y:auto;flex:1}
.live-body li{padding:10px 14px;border-bottom:1px solid #f1f1f1}
.live-body li.is-new{background:#ecfdf5}
.live-body a{color:var(--ink);text-decoration:none;font-weight:600;font-size:14.5px;line-height:1.35}
.live-body a:hover{text-decoration:underline}
.live-meta{margin-top:3px;font-size:12px;color:var(--muted);display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.src{background:#eef2f7;color:#334155;border-radius:4px;padding:0 6px;font-weight:600}
.tag{border-radius:4px;padding:0 6px;color:#fff;font-size:11px;font-weight:800}
.tag.brk{background:var(--red)}
.tag.ann{background:var(--amber)}
.live-empty{padding:18px 14px;color:var(--muted)}

footer.site-footer{max-width:1400px;margin:30px auto;padding:0 20px;color:var(--muted);font-size:13px}

@media(max-width:980px){
  .layout{grid-template-columns:1fr}
  .live{position:static;max-height:none}
  .live-body{max-height:70vh}
}

.panel{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:12px 16px}
.panel h3{margin:0 0 6px;font-size:16px}
.panel ul{list-style:none;margin:0;padding:0}
.panel li{padding:8px 0;border-top:1px solid #f1f1f1}
.panel li:first-child{border-top:0}
.panel a{color:var(--ink);text-decoration:none;font-weight:500}
.panel a:hover{text-decoration:underline}
.panel .tag{margin-right:6px}

/* live sidebar v1.3 */
.tag.prs{background:#2563eb}
.tag.ern{background:#7c3aed}
.live-body{padding:0}
.live-body ul{list-style:none;margin:0;padding:0}
.live-body .live-empty{padding:12px 14px;margin:0}
.src-box{border-bottom:1px solid var(--line)}
.src-box summary{cursor:pointer;padding:9px 14px;background:#f8fafc;font-weight:700;font-size:14px;position:sticky;top:0;z-index:1}
.live-filters select{width:100%}

.live-sec{margin:0;padding:8px 14px;background:var(--dark);color:#fff;font-size:13px;letter-spacing:.3px}
.live-count{margin:0;padding:6px 14px;font-size:12px;color:var(--muted);background:#f8fafc;border-bottom:1px solid var(--line)}
.live-divider{padding:6px 14px;font-size:12px;font-weight:700;background:#f1f5f9;color:#475569}

/* every RSS feed in its own box, 4 per line; more feeds wrap to the next lines */
.feed-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:18px}
.feed-row .panel{padding:10px 12px}
.feed-row .panel h3 a{color:var(--ink);text-decoration:none}
.feed-row .panel h3 a:hover{color:var(--brand)}
.feed-row .panel li{font-size:13.5px}
.feed-row .panel a{overflow-wrap:anywhere}
.feed-row .live-meta{font-size:11.5px}

/* search + small-cap filter above the feed boxes */
.feed-search{display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin-bottom:14px;background:var(--card);border:1px solid var(--line);border-radius:10px;padding:10px 14px}
.feed-search input[type=search]{flex:1 1 280px;padding:8px 10px;border:1px solid var(--line);border-radius:6px;font:inherit}
.feed-search label{display:flex;gap:6px;align-items:center;font-weight:600;font-size:14px}
.tag.deal{background:#0d9488}

/* full-width layout: feed columns stretch close to the screen edges */
.site-top,.site-links,.layout,footer.site-footer{max-width:none}
.site-top{padding:12px 14px}
.site-links{padding:0 14px 12px}
footer.site-footer{padding:0 14px}
.layout{margin:14px 0;padding:0 14px;gap:14px;grid-template-columns:minmax(0,1fr) clamp(340px,24vw,480px)}
@media(max-width:980px){.layout{grid-template-columns:1fr}}
.feed-row{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
@media(max-width:1200px){.feed-row{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:800px){.feed-row{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){.feed-row{grid-template-columns:1fr}}
.feed-search select{padding:7px 9px;border:1px solid var(--line);border-radius:6px;font:inherit}

/* account links + login / register cards */
.acct{margin-left:auto;display:flex;gap:12px;align-items:center;font-size:13px;color:#cbd5e1}
.acct a{color:#e2e8f0;font-weight:600;text-decoration:none;padding:4px 10px;border-radius:6px;background:#1e293b}
.acct a:hover{background:var(--brand);color:#fff}
.layout.no-live{grid-template-columns:1fr}
.no-live .content{max-width:640px;margin:0 auto;width:100%}
.prompt-card h2{margin:0 0 6px}
.auth-card{max-width:440px;background:var(--card);border:1px solid var(--line);border-radius:10px;padding:18px 20px;margin:8px 0 14px}
.auth-card label{display:block;font-weight:600;font-size:14px;margin-bottom:10px}
.auth-card label.inline{display:flex;gap:6px;align-items:center;font-weight:500}
.auth-card input:not([type=checkbox]){display:block;width:100%;margin-top:4px;padding:9px 10px;border:1px solid var(--line);border-radius:6px;font:inherit}
.auth-card button{width:100%;padding:10px;border:0;border-radius:6px;background:var(--brand);color:#fff;font-weight:700;font-size:15px;cursor:pointer}
.auth-links{font-size:14px;color:var(--muted)}
.auth-msg{padding:8px 10px;border-radius:6px;font-size:14px;margin:0 0 12px}
.auth-msg.err{background:#fef2f2;color:#991b1b;border:1px solid #fecaca}
.auth-msg.ok{background:#ecfdf5;color:#065f46;border:1px solid #a7f3d0}

/* live market video */
.tv{background:var(--card);border:1px solid var(--line);border-radius:10px;margin-bottom:14px;overflow:hidden}
.tv-head{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:10px 12px;background:var(--dark)}
.tv-head .tv-label{color:#94a3b8;font-size:12px;font-weight:700;margin-right:4px}
.tv-head button{padding:6px 12px;border:0;border-radius:999px;background:#1e293b;color:#e2e8f0;font:600 13px system-ui;cursor:pointer}
.tv-head button.on{background:var(--brand);color:#fff}
.tv-body{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr)}
.tv-frame{position:relative;aspect-ratio:16/9;background:#000}
.tv-frame iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.tv-play{position:absolute;inset:0;display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;background:#0f172a;color:#fff;border:0;width:100%;cursor:pointer;font:700 18px system-ui}
.tv-play span{font-weight:500;font-size:13px;color:#94a3b8}
.tv-side{display:flex;flex-direction:column;min-width:0;max-height:100%}
.tv-title{margin:0;padding:10px 14px;font-size:14px;background:#f8fafc;border-bottom:1px solid var(--line)}
.tv-list{list-style:none;margin:0;padding:0;overflow-y:auto;max-height:300px}
.tv-list li a{display:flex;gap:10px;padding:8px 14px;border-bottom:1px solid #f1f1f1;color:var(--ink);text-decoration:none;font-size:13.5px;font-weight:600;line-height:1.3}
.tv-list li a:hover{background:#f8fafc}
.tv-list img{width:96px;aspect-ratio:16/9;object-fit:cover;border-radius:4px;flex:none;background:#e5e7eb}
.tv-list .tv-meta{display:block;font-weight:500;font-size:12px;color:var(--muted);margin-top:2px}
.tv-note{margin:0;padding:8px 14px;font-size:12px;color:var(--muted)}
.tv-note a{color:var(--brand)}
@media(max-width:800px){.tv-body{grid-template-columns:1fr}}

.alert-types{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;margin-top:8px;font-size:13px}
.alert-types>span{font-weight:700}
.alert-types label{display:flex;gap:5px;align-items:center}

/* members chat room (bottom of page) */
.chat{margin:14px;background:var(--card);border:1px solid var(--line);border-radius:10px;overflow:hidden}
.chat-head{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:baseline;padding:10px 14px;background:var(--dark);color:#fff}
.chat-head span{font-size:12.5px;color:#94a3b8}
.chat-head a{color:#86efac}
.chat-log{height:300px;overflow-y:auto;padding:8px 14px;background:#fff}
.chat-msg{padding:6px 0;border-bottom:1px solid #f1f1f1;position:relative}
.chat-msg strong{font-size:14px;margin-right:8px}
.chat-time{font-size:12px;color:var(--muted)}
.chat-text{font-size:14.5px;overflow-wrap:anywhere}
.chat-del{position:absolute;right:0;top:4px;border:0;background:none;color:var(--red);font-size:18px;line-height:1;cursor:pointer}
.chat-empty{margin:8px 0;color:var(--muted);font-size:14px}
.chat-form{display:flex;gap:8px;padding:10px 14px;border-top:1px solid var(--line);background:#f8fafc}
.chat-form input{flex:1;padding:9px 10px;border:1px solid var(--line);border-radius:6px;font:inherit}
.chat-form button{padding:9px 18px;border:0;border-radius:6px;background:var(--brand);color:#fff;font-weight:700;cursor:pointer}

.live-filters .alert-types{margin-top:10px;font-size:12.5px;gap:4px 12px}

/* bottom columns: top 20 gainers | chat */
.bottom-cols{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:14px;margin:14px;align-items:start}
.bottom-cols .chat{margin:0}
@media(max-width:980px){.bottom-cols{grid-template-columns:1fr}}
.gainers{background:var(--card);border:1px solid var(--line);border-radius:10px;overflow:hidden}
.g-title{display:flex;flex-wrap:wrap;gap:4px 14px;align-items:baseline;padding:10px 14px;background:var(--dark);color:#fff}
.g-status{font-size:12px;color:#94a3b8}
.g-head{display:flex;flex-wrap:wrap;gap:10px;align-items:center;padding:8px 14px;border-bottom:1px solid var(--line);font-size:13px}
.g-tabs{display:flex;gap:6px}
.g-tabs button{padding:5px 12px;border:1px solid var(--line);border-radius:999px;background:#f9fafb;font:600 13px system-ui;cursor:pointer}
.g-tabs button.on{background:var(--dark);color:#fff;border-color:var(--dark)}
.g-wrap{overflow:auto;max-height:520px}
.g-table{width:100%;border-collapse:collapse;font-size:13.5px}
.g-table th{position:sticky;top:0;background:#f8fafc;text-align:left;padding:7px 10px;border-bottom:1px solid var(--line);white-space:nowrap}
.g-table td{padding:6px 10px;border-bottom:1px solid #f1f1f1;white-space:nowrap}
.g-table .num{text-align:right}
.g-table .g-name{white-space:normal;min-width:140px}
.g-table a{font-weight:700;color:var(--ink);text-decoration:none}
.g-table a:hover{color:var(--brand)}
.g-table .up{color:#047857}
.g-table .pct{font-weight:700}
.g-empty{padding:14px;margin:0;color:var(--muted)}
.g-links{list-style:none;margin:0;padding:10px 14px;border-top:1px solid var(--line);display:flex;flex-wrap:wrap;gap:6px 16px;font-size:14px}
.g-links a{color:var(--brand);font-weight:600;text-decoration:none}
