/* ============================================================
   cfm-shared.css — CFM-Stellonyx 3.0
   Shared stylesheet for all Cool FM pages.
   ============================================================ */
html { zoom: 1.10; } /* desktop only — overridden by mobile queries below */

/* ============================================================
   CUSTOM SCROLLBARS -- CFM-Stellonyx theme
   ============================================================ */
html, body, div, section, article, aside, main, nav, textarea, pre, code {
    scrollbar-width: thin;
    scrollbar-color: var(--dim-cyan) var(--scrollbar-track);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-left: 1px solid var(--scrollbar-border);
}
::-webkit-scrollbar-thumb {
    background: var(--dim-cyan);
    border-radius: 0;
    border: 1px solid var(--scrollbar-border);
    box-shadow: inset 0 0 4px rgba(0,242,255,0.15);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-cyan);
    box-shadow: 0 0 6px rgba(0,242,255,0.5);
}
::-webkit-scrollbar-corner { background: var(--scrollbar-track); }
::-webkit-scrollbar-button:single-button {
    background: var(--scrollbar-track);
    border: 1px solid var(--scrollbar-border);
    display: block;
    height: 14px;
    width: 8px;
}
::-webkit-scrollbar-button:single-button:vertical:decrement {
    background-color: var(--scrollbar-track);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpolygon points='4,1 7,6 1,6' fill='%23008b94'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}
::-webkit-scrollbar-button:single-button:vertical:decrement:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpolygon points='4,1 7,6 1,6' fill='%2300f2ff'/%3E%3C/svg%3E");
}
::-webkit-scrollbar-button:single-button:vertical:increment {
    background-color: var(--scrollbar-track);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpolygon points='4,7 7,2 1,2' fill='%23008b94'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}
::-webkit-scrollbar-button:single-button:vertical:increment:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpolygon points='4,7 7,2 1,2' fill='%2300f2ff'/%3E%3C/svg%3E");
}

/* ============================================================
   SITE ANNOUNCEMENT BANNER
   ============================================================ */
#cfm-announce {
    display: none;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 18px;
    font-family: var(--hacker-font);
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-align: center;
    border-radius: 3px;
    margin-bottom: 6px;
    border-left: 4px solid;
    position: relative;
    overflow: hidden;
}
#cfm-announce::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 8px,
        rgba(255,255,255,0.02) 8px,
        rgba(255,255,255,0.02) 16px
    );
    pointer-events: none;
}
#cfm-announce.amber { background: rgba(240,165,0,0.12);  border-color: #f0a500; color: #f0a500; }
#cfm-announce.red   { background: rgba(255,78,78,0.12);  border-color: #ff4e4e; color: #ff4e4e; animation: cfm-pulse 2s ease-in-out infinite; }
#cfm-announce.green { background: rgba(0,255,136,0.1);   border-color: #00ff88; color: #00ff88; }
#cfm-announce.cyan  { background: rgba(0,242,255,0.08);  border-color: #00f2ff; color: #00f2ff; }
#cfm-announce.blue  { background: rgba(0,100,255,0.12);  border-color: #0064ff; color: #6ab0ff; }
@keyframes cfm-pulse {
    0%,100% { box-shadow: 0 0 8px rgba(255,78,78,0.3); }
    50%      { box-shadow: 0 0 18px rgba(255,78,78,0.7); }
}
#cfm-announce .ann-icon { margin-right: 8px; font-size: 0.8rem; }

/* ============================================================
   UNIVERSAL SECTION LABEL
   ============================================================ */
.cfm-section-label {
    color: var(--primary-cyan);
    font-family: var(--hacker-font);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cfm-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--dim-cyan);
    opacity: 0.4;
}

/* Changelog chip + menuheader flex */
.menuheader-flex { display: flex; align-items: center; justify-content: space-between; }
.menuheader-flex h3 { margin: 0; }
.changelog-chip {
    font-family: var(--hacker-font);
    font-size: 0.52rem;
    letter-spacing: 1px;
    padding: 2px 7px;
    border: 1px solid var(--dim-cyan);
    color: var(--dim-cyan);
    background: transparent;
    border-radius: 2px;
    text-decoration: none;
    text-transform: uppercase;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.changelog-chip:hover { background: var(--dim-cyan); color: #fff; }

/* in-iframe */
body.in-iframe .tablecfm { display: none !important; }

/* ============================================================
   CSS VARIABLES — DARK THEME (default)
   ============================================================ */
:root {
    --bg-color: #0a0b0d;
    --surface-color: #161b22;
    --primary-cyan: #00f2ff;
    --dim-cyan: #008b94;
    --text-main: #e6edf3;
    --text-dim: #8b949e;
    --border-glow: 0 0 10px rgba(0, 242, 255, 0.4);
    --hacker-font: 'Courier New', Courier, monospace;
    --scrollbar-track: #0d1a1a;
    --scrollbar-border: #005f66;
    --panel-bg: rgba(0, 0, 0, 0.95);
    --border-color: #30363d;
    --header-bg: #21262d;
    --nowplaying-bg: #000000;
    --header-bg-img: url('path-to-your-dark-image.jpg');
    --header-overlay: rgba(10, 11, 13, 0.85);

    /* Status page */
    --status-ok:       #00ff88;
    --status-test:     #f0a500;
    --status-degraded: #ff4e4e;

    /* Stream / VU meter */
    --vu-bg:    #0a0b0d;
    --vu-off:   #0d1f1f;
    --vu-low:   #00f2ff;
    --vu-mid:   #f0a500;
    --vu-hot:   #ff4e4e;
    --vu-peak:  #ff1a1a;
    --vu-label: #8b949e;

    /* Skycam HUD */
    --skycam-hud-bg: rgba(0,0,0,0.78);
}

/* ============================================================
   CSS VARIABLES — LIGHT THEME
   ============================================================ */
[data-theme="light"] {
    --scrollbar-track: #dde6ee;
    --scrollbar-border: #b0c4de;
    --bg-color: #f0f2f5;
    --surface-color: #ffffff;
    --primary-cyan: #00707a;
    --dim-cyan: #00b4c4;
    --text-main: #1a1d21;
    --text-dim: #4a5568;
    --border-glow: 0 0 8px rgba(0, 112, 122, 0.2);
    --panel-bg: rgba(255, 255, 255, 0.98);
    --border-color: #d1d9e0;
    --header-bg: #e2e8f0;
    --nowplaying-bg: #e2e8f0;
    --header-bg-img: url('path-to-your-light-image.jpg');
    --header-overlay: rgba(255, 255, 255, 0.6);
    --vu-bg:    #e8edf2;
    --vu-off:   #d0dae3;
    --vu-low:   #00707a;
    --vu-mid:   #c47e00;
    --vu-hot:   #cc3300;
    --vu-peak:  #aa0000;
    --vu-label: #4a5568;
    --skycam-hud-bg: rgba(230,236,242,0.92);
}

/* ============================================================
   BASE STYLES
   ============================================================ */
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    caret-color: transparent;
}

.post-scroll-wrapper,
.menucontent,
.cfm_progress_detail,
.cfm_progress_header,
#cfm_nowplaying,
#cfm_upnext,
.history-track-text {
    user-select: text;
    -webkit-user-select: text;
    outline: none;
    caret-color: transparent;
}

#container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

/* ============================================================
   HEADER
   ============================================================ */
#header {
    height: 120px;
    background: linear-gradient(var(--header-overlay), var(--header-overlay)), var(--header-bg-img);
    background-size: cover;
    background-position: center;
    border-bottom: 2px solid var(--primary-cyan);
    box-shadow: var(--border-glow);
    margin-bottom: 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.5s ease;
}
.header-logo { max-height: 110px; width: auto; position: relative; z-index: 10; }

/* ============================================================
   NOW PLAYING
   ============================================================ */
.tablecfm {
    background: var(--nowplaying-bg);
    border: 1px solid var(--dim-cyan);
    padding: 8px 25px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-family: var(--hacker-font);
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s ease;
}
.track-row { display: flex; margin-bottom: 4px; align-items: center; position: relative; z-index: 2; }
.track-row:last-of-type { margin-bottom: 0; }
.cfm-label { display: inline-block; width: 90px; color: var(--primary-cyan); font-weight: bold; text-transform: uppercase; }
.cfm-history-trigger { cursor: pointer; }
.cfm-history-trigger span { transition: 0.3s; border-bottom: 1px dashed transparent; }
.cfm-history-trigger:hover span { text-shadow: 0 0 10px var(--primary-cyan); border-bottom: 1px dashed var(--primary-cyan); }
#cfm_nowplaying, #cfm_upnext { color: var(--text-main); text-shadow: 0 0 8px var(--primary-cyan); }

/* History panel */
#cfm_history_panel {
    display: none;
    background: var(--panel-bg);
    border-top: 1px solid var(--dim-cyan);
    margin: 8px -25px -8px -25px;
    padding: 15px 25px;
    position: relative;
    z-index: 1;
}
.history-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#cfm_history_list { list-style: none; padding: 0; margin: 0; font-size: 0.8rem; }
#cfm_history_list li {
    padding: 6px 8px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.5s ease-out forwards;
    transition: background 0.2s ease;
}
#cfm_history_list li:hover { background: rgba(128,128,128,0.1); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.history-search-btn {
    color: var(--primary-cyan); text-decoration: none; font-size: 0.7rem;
    border: 1px solid var(--dim-cyan); padding: 2px 8px; border-radius: 3px;
    transition: 0.3s; margin-left: 10px; flex-shrink: 0;
}
.history-search-btn:hover { background: var(--dim-cyan); color: #fff; box-shadow: 0 0 8px var(--primary-cyan); }
#cfm_history_list li:last-child { border-bottom: none; }
#cfm_history_list li::before { content: "> "; color: var(--primary-cyan); margin-right: 5px; flex-shrink: 0; }
.history-track-text { flex-grow: 1; text-align: left; }
#cfm_history_toggle_auto { cursor: pointer; font-size: 0.65rem; color: #00ff00; text-transform: uppercase; transition: 0.3s; }

/* Theme toggle */
.theme-toggle { cursor: pointer; font-size: 1.1rem; padding: 0 5px; transition: transform 0.3s ease; user-select: none; }
.theme-toggle:hover { transform: scale(1.2); }

/* ============================================================
   GRID LAYOUT — three-column
   ============================================================ */
#content {
    display: grid;
    grid-template-columns: 260px 1fr 280px;
    gap: 20px;
    align-items: start;
}

.menu, .post {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    position: relative;
}

/* ── Panel height: use sync-height when JS sets it,
      otherwise fall back to a sensible minimum so panels
      never collapse to nothing before sitedata loads ─── */
.sync-height {
    min-height: 340px;
}

.menuheader, .postheader {
    background: var(--header-bg);
    padding: 12px 15px;
    border-bottom: 1px solid var(--dim-cyan);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 5;
}
.menuheader h3 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--primary-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Listener count */
#cfm_onlinelisteners {
    color: var(--primary-cyan);
    font-weight: bold;
    text-shadow: 0 0 10px var(--primary-cyan);
    animation: pulse-glow 2s infinite ease-in-out;
    margin-left: 5px;
}
@keyframes pulse-glow {
    0%   { text-shadow: 0 0 8px rgba(0,242,255,0.4); }
    50%  { text-shadow: 0 0 18px rgba(0,242,255,1); }
    100% { text-shadow: 0 0 8px rgba(0,242,255,0.4); }
}

/* Scrollable content areas */
.menucontent, .post-scroll-wrapper {
    padding: 20px;
    overflow-y: auto;
    position: relative;
    color: var(--text-main);
    flex: 1;
}

/* Scroll panels with constrained max-height for sidebar menus.
   cfm-links-scroll cut off around Official FMDX so user must scroll. */
.cfm-panel-scroll { overflow-y: auto; padding: 14px 16px; flex: 1; max-height: 170px; }
.cfm-links-scroll  { overflow-y: auto; padding: 14px 16px; flex: 1; max-height: 185px; }

/* Updates right column: allow full height, scroll only if overflow */
.scroll-area { overflow-y: auto; flex: 1; }

/* Fade at bottom of scroll areas */
.scroll-fade::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(transparent, var(--surface-color));
    pointer-events: none;
    z-index: 2;
}

/* Nav/links list styles */
.menucontent ul { list-style: none; padding: 0; margin: 0; }
.menucontent li { margin-bottom: 15px; }
.menucontent a {
    color: var(--text-dim);
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    position: relative;
    padding-bottom: 2px;
}
.menucontent a::after {
    content: '';
    position: absolute;
    width: 0; height: 1px;
    bottom: 0; left: 0;
    background-color: var(--primary-cyan);
    box-shadow: 0 0 8px var(--primary-cyan);
    transition: width 0.3s ease;
}
.menucontent a:hover { color: var(--primary-cyan); text-shadow: 0 0 10px var(--primary-cyan); padding-left: 5px; }
.menucontent a:hover::after { width: 100%; }
.menucontent a::after { left: 0; right: auto; }
.menucontent a:not(:hover)::after { left: auto; right: 0; }
.cfm_progress_detail a { color: var(--primary-cyan); text-decoration: none; border-bottom: 1px solid transparent; transition: 0.3s; }
.cfm_progress_detail a:hover { text-shadow: 0 0 12px var(--primary-cyan); border-bottom: 1px solid var(--primary-cyan); }

/* Update timeline cards */
.cfm-update-card { padding: 10px 0 10px 12px; border-left: 2px solid #1a3535; margin-bottom: 4px; transition: border-color 0.2s; }
.cfm-update-card:hover { border-left-color: var(--dim-cyan); }
.cfm-update-card:first-child { border-left-color: var(--dim-cyan); }
.cfm-update-badge { display: block; font-family: var(--hacker-font); font-size: 0.68rem; font-weight: bold; letter-spacing: 2px; color: var(--primary-cyan); text-transform: uppercase; margin-bottom: 3px; }
.cfm-update-text  { font-size: 0.78rem; color: var(--text-dim); line-height: 1.5; margin: 0 0 5px 0; }
.cfm-update-link  { font-family: var(--hacker-font); font-size: 0.58rem; letter-spacing: 1px; text-transform: uppercase; color: var(--dim-cyan); text-decoration: none; transition: color 0.2s; }
.cfm-update-link:hover { color: var(--primary-cyan); }
.cfm-update-link::before { content: "\25B6  "; font-size: 0.5rem; }

/* Weather telemetry bar */
.cfm_wx_container { padding: 20px; border-top: 1px solid var(--border-color); text-align: center; background: rgba(128,128,128,0.1); position: relative; z-index: 5; }
#cfm_wx { font-family: var(--hacker-font); color: var(--primary-cyan); font-size: 0.9rem; }

/* Footer */
#footer {
    grid-column: 1 / -1;
    text-align: center;
    padding: 15px 20px 40px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    margin-top: 10px;
}
#footer ul { list-style: none; padding: 0; display: flex; justify-content: center; gap: 25px; margin-bottom: 15px; }
#footer a { color: var(--primary-cyan); text-decoration: none; transition: 0.3s; }
#footer a:hover { text-shadow: 0 0 10px var(--primary-cyan); color: var(--text-main); }

/* Shared fade-in animation */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE — 950px
   ============================================================ */
@media (max-width: 950px) {
    #content { grid-template-columns: 1fr; }
    .sync-height { height: auto !important; min-height: 0; }
}

/* ============================================================
   RESPONSIVE — TABLET 768px
   ============================================================ */
@media (max-width: 768px) {
    html { zoom: 1 !important; font-size: 15px; }
    #container { padding: 0 10px; margin: 10px auto; }
    #header { height: 80px; margin-bottom: 12px; }
    .header-logo { max-height: 70px; }
    #content { grid-template-columns: 1fr; gap: 12px; }
    .sync-height { height: auto !important; min-height: 0; }
    .tablecfm { padding: 6px 14px; }
    .menucontent ul li a { padding: 6px 4px; display: block; }
    .wx-table, table { overflow-x: auto; display: block; width: 100%; }
}

/* ============================================================
   RESPONSIVE — PHONE 480px
   ============================================================ */
@media (max-width: 480px) {
    html { zoom: 1 !important; font-size: 14px; }
    #container { padding: 0 6px; margin: 6px auto; }
    #header { height: 60px; margin-bottom: 8px; border-radius: 4px 4px 0 0; }
    .header-logo { max-height: 52px; }
    #content { gap: 8px; }
    .tablecfm { padding: 5px 10px; font-size: 0.82rem; }
    .menuheader h3, .postheader h3 { font-size: 0.85rem; }
    .menucontent { padding: 12px; }
    .menucontent ul li { margin-bottom: 10px; }
    .menucontent ul li a { font-size: 1rem; padding: 8px 6px; display: flex; align-items: center; min-height: 40px; }
    .cfm-update-badge { font-size: 0.7rem; letter-spacing: 1px; }
    .cfm-update-text  { font-size: 0.82rem; }
    .cfm-update-link  { font-size: 0.65rem; padding: 4px 10px; }
    #footer ul { flex-wrap: wrap; gap: 12px; justify-content: center; }
    #footer { padding: 12px 10px 30px; font-size: 0.78rem; }
    .wx-table, table { overflow-x: auto; display: block; font-size: 0.75rem; }
}
