/* ═══════════════════════════════════════════════════
   FXDetails Design System v6.0.0
   ForexFactory-Inspired Professional Trading Theme
   ═══════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    /* Primary palette — Exact ForexFactory Navy */
    --fx-primary: linear-gradient(#37548a, #283e66);
    --fx-primary-dark: #304978;
    --fx-primary-light: #3a5a8a;

    /* Accent — Exact FF Green */
    --fx-accent: #7dbb42;
    --fx-accent-hover: #6ca038;
    --fx-accent-light: rgba(125, 187, 66, 0.1);

    /* Impact colors (ForexFactory standard) */
    --fx-impact-red: #cc3333;
    --fx-impact-orange: #e68a00;
    --fx-impact-yellow: #d4a017;
    --fx-impact-gray: #7a8a9e;

    /* Status */
    --fx-success: #2e8b3a;
    --fx-danger: #c33;

    /* Text */
    --fx-text: #333333;
    --fx-text-secondary: #666666;   /* WCAG AA ≥4.5:1 on light panels */
    --fx-text-muted: #616161;       /* ≥4.5:1 on panels (was #999/#6e6e6e) */
    --fx-text-heading: #111111;

    /* Backgrounds */
    --fx-bg: #e6e6e6;
    --fx-bg-panel: #ebeef2;
    --fx-bg-panel-alt: linear-gradient(to top, #304978, #37548a);
    /* Panel header gradient */
    --fx-bg-hover: #ffffff;
    --fx-bg-input: #ffffff;

    /* Borders */
    --fx-border: #ccd5e0;
    --fx-border-light: #e0e0e0;
    --fx-border-dark: #384b6f;

    /* Typography — crisp modern system stack (sharper than Verdana on modern
       displays, zero webfont load). Data uses the same stack for tabular nums. */
    --fx-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --fx-font-data: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --fx-font-xs: 11px;
    --fx-font-sm: 12px;
    --fx-font-base: 13px;
    --fx-font-md: 14px;
    --fx-font-lg: 15px;
    --fx-font-xl: 17px;
    --fx-font-2xl: 20px;

    /* Spacing — tighter, more data-dense */
    --fx-sp-1: 4px;
    --fx-sp-2: 6px;
    --fx-sp-3: 10px;
    --fx-sp-4: 14px;
    --fx-sp-5: 18px;
    --fx-sp-6: 22px;
    --fx-sp-8: 28px;
    --fx-sp-10: 36px;
    --fx-sp-12: 44px;

    /* Layout */
    --fx-max-width: 1280px;
    --fx-left-sidebar: 170px;
    --fx-right-sidebar: 260px;
    --fx-gap: 12px;

    /* Effects — minimal, professional */
    --fx-radius: 3px;
    --fx-radius-sm: 2px;
    --fx-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    --fx-shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3);
    --fx-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4);
    --fx-transition: 0.12s ease;

    /* ══════════════════════════════════════════════════════════════════
       RESPONSIVE LAYER (v10.26) — foundation for the mobile UX rebuild.
       Breakpoint convention (use these, not ad-hoc values):
         --fx-bp-tablet 1024px · --fx-bp-mobile 960px (nav + grid collapse
         together) · --fx-bp-compact 600px.
       Everything below is DECLARED here but CONSUMED only inside max-width
       media queries, so desktop rendering is unchanged. Fluid clamp() maxes
       equal today's desktop px — desktop never shifts; only sub-breakpoint
       sizes scale down.
       ══════════════════════════════════════════════════════════════════ */
    --fx-bp-tablet: 1024px;
    --fx-bp-mobile: 960px;
    --fx-bp-compact: 600px;

    /* Was referenced but never declared, so the custom scrollbar thumb
       (empty-track bug), the unused .fx-btn--secondary border, and the
       hero-card hover border all silently dropped. Neutral cool-gray matching
       the existing .fxd-lang-grid scrollbar — fixes the bug with no new brand
       colour on desktop. */
    --fx-border-accent: #c4cdd5;

    /* Systemic minimum touch target (consumed in mobile queries) */
    --fx-touch: 44px;

    /* Mobile-facing type tokens (consumed only in mobile queries) */
    --fx-font-nav-m: 15px;      /* mobile nav-row label */
    --fx-font-body-m: 15px;     /* mobile long-form article body */
    --fx-font-input-m: 16px;    /* mobile form inputs — prevents iOS auto-zoom */

    /* Fluid headline scale — upper bound == current desktop size */
    --fx-h1-hero: clamp(1.25rem, 3.6vw, 1.75rem);
    --fx-h1-article: clamp(1.2rem, 3.2vw, 1.625rem);
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background: var(--fx-bg) repeating-linear-gradient(45deg, #e5e5e5, #e5e5e5 2px, #ececec 2px, #ececec 5px) !important;
    color: var(--fx-text);
    font-family: var(--fx-font);
    font-size: var(--fx-font-base);
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a {
    color: #0e5094;
    text-decoration: none;
    transition: color var(--fx-transition);
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--fx-font);
    color: var(--fx-text-heading);
    line-height: 1.3;
    margin: 0;
}

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */

.fx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 14px;
    font-size: var(--fx-font-sm);
    font-weight: 600;
    font-family: var(--fx-font);
    border-radius: var(--fx-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--fx-transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.fx-btn--primary {
    background: var(--fx-accent);
    color: #fff;
    border-color: var(--fx-accent);
}

.fx-btn--primary:hover {
    background: var(--fx-accent-hover);
    color: #fff;
    border-color: var(--fx-accent-hover);
}

.fx-btn--secondary {
    background: transparent;
    color: var(--fx-accent);
    border: 1px solid var(--fx-border-accent);
}

.fx-btn--secondary:hover {
    background: var(--fx-accent-light);
    color: var(--fx-accent-hover);
    border-color: var(--fx-accent);
}

.fx-btn--sm {
    padding: 4px 10px;
    font-size: var(--fx-font-xs);
}

.fx-btn--lg {
    padding: 10px 20px;
    font-size: var(--fx-font-md);
}

/* ══════════════════════════════════════
   BADGES
   ══════════════════════════════════════ */

.fx-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 2px;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.fx-badge--success {
    background: rgba(46, 139, 58, 0.15);
    color: #4ade80;
}

.fx-badge--danger {
    background: rgba(204, 51, 51, 0.15);
    color: #f87171;
}

.fx-badge--warning {
    background: rgba(230, 138, 0, 0.15);
    color: #fbbf24;
}

.fx-badge--info {
    background: rgba(74, 144, 217, 0.15);
    color: var(--fx-accent);
}

.fx-badge--gray {
    background: var(--fx-bg-panel-alt);
    color: var(--fx-text-muted);
}

/* ══════════════════════════════════════
   PANELS — FF-style boxed sections
   ══════════════════════════════════════ */

.fx-panel {
    background: var(--fx-bg-panel);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius);
    overflow: hidden;
    margin-bottom: var(--fx-gap);
}

.fx-panel-header {
    background: var(--fx-bg-panel-alt);
    color: #fff;
    font-size: var(--fx-font-xs);
    font-weight: 600;
    padding: 5px 10px;
    border-bottom: 1px solid var(--fx-border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 23px;
}

.fx-panel-header span {
    color: #fff;
}

.fx-panel-header a {
    color: #a8c4e0;
    font-weight: 400;
    font-size: 11px;
    text-decoration: none;
}

/* ══════════════════════════════════════
   FXD HEAD (ForexFactory Style Panel Header)
   ══════════════════════════════════════ */

.fxd-head {
    background: var(--fx-bg-panel-alt);
    margin: 0;
    padding: 0;
    width: 100%;
    border-bottom: 1px solid var(--fx-border-dark);
}

.fxd-head ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    height: 23px;
    /* Exact FF Height */
}

.fxd-head li {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 10px;
    border-right: none;
    min-width: 0;
    overflow: hidden;
}

.fxd-head li:last-child {
    border-right: none;
}

.fxd-head li.noborder {
    border-right: none !important;
}

.fxd-head li.left {
    margin-right: auto;
}

.fxd-head li.right {
    margin-left: auto;
}

.fxd-head li h2,
.fxd-head li h3,
.fxd-head li span.title {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    text-transform: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Removed the accent line before headers */

/* Kỹ thuật Hover SVG kép giống FF */
.fxd-svg-hover .svg-hover {
    display: none;
}

.fxd-svg-hover:hover .svg-default {
    display: none;
}

.fxd-svg-hover:hover .svg-hover {
    display: block;
}

/* Nút bấm trong header */
.fxd-sub-button {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
    padding: 4px;
    border-radius: 3px;
    transition: background var(--fx-transition);
}

.fxd-sub-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.fxd-head a {
    color: #ffffff;
    font-size: var(--fx-font-xs);
    font-weight: 500;
    text-decoration: none;
}

.fxd-head a:hover {
    color: #e0e0e0;
}

.fx-panel-body {
    padding: 0;
    background: var(--fx-bg-panel);
    /* #ebeef2 */
    border-left: 1px solid var(--fx-border);
    /* #ccd5e0 */
    border-right: 1px solid var(--fx-border);
    border-bottom: 1px solid var(--fx-border);
}

.fx-panel-footer {
    display: block;
    text-align: center;
    padding: 8px;
    font-size: var(--fx-font-xs);
    font-weight: 600;
    color: var(--fx-accent);
    background: var(--fx-bg-panel-alt);
    border-top: 1px solid var(--fx-border);
    text-decoration: none;
    transition: background var(--fx-transition);
}

.fx-panel-footer:hover {
    background: var(--fx-bg-hover);
    color: var(--fx-accent-hover);
}

/* ══════════════════════════════════════
   TABLES — compact, data-dense
   ══════════════════════════════════════ */

.fx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fx-font-sm);
    font-family: var(--fx-font-data);
}

.fx-table th,
.fx-table td {
    padding: 6px 10px;
    border: 1px solid var(--fx-border);
    text-align: left;
}

.fx-table th {
    background: var(--fx-bg-panel-alt);
    font-weight: 600;
    font-size: var(--fx-font-xs);
    color: var(--fx-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.fx-table tr:hover td {
    background: var(--fx-bg-hover);
}

/* ── Impact dots ── */
.fx-impact {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.fx-impact--high {
    background: var(--fx-impact-red);
}

.fx-impact--medium {
    background: var(--fx-impact-orange);
}

.fx-impact--low {
    background: var(--fx-impact-yellow);
}

.fx-impact--none {
    background: var(--fx-impact-gray);
}

/* ── Stars ── */
.fx-stars {
    color: var(--fx-impact-orange);
    letter-spacing: 1px;
    font-size: var(--fx-font-sm);
}

/* ── Pros/Cons ── */
.fx-pro::before {
    content: "\2713 ";
    color: var(--fx-success);
    font-weight: 700;
}

.fx-con::before {
    content: "\2717 ";
    color: var(--fx-danger);
    font-weight: 700;
}

/* ── Gradient placeholder thumbnails ── */
.fxd-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    background: linear-gradient(135deg, var(--fx-primary-light), var(--fx-bg-panel-alt));
}

.fxd-thumb-placeholder.fxd-news-thumb {
    width: 90px;
    height: 62px;
    border-radius: var(--fx-radius);
    flex-shrink: 0;
}

.fxd-thumb-icon {
    opacity: 0.25;
    color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fxd-thumb-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.fxd-news-thumb-link {
    flex-shrink: 0;
    text-decoration: none;
}

.fxd-featured-placeholder {
    width: 100%;
    height: 200px;
    border-radius: var(--fx-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--fx-primary-light), #1a3054);
}

.fxd-featured-ph-icon {
    opacity: 0.15;
    color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fxd-featured-ph-icon svg {
    width: 40px;
    height: 40px;
    stroke: currentColor;
}

.fxd-featured-ph-cat {
    font-size: var(--fx-font-xs);
    font-weight: 600;
    color: rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ══════════════════════════════════════
   SCROLLBAR STYLING
   ══════════════════════════════════════ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--fx-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--fx-border-accent);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--fx-text-muted);
}

/* ══════════════════════════════════════
   SELECTION
   ══════════════════════════════════════ */

::selection {
    background: rgba(74, 144, 217, 0.3);
    color: #fff;
}

/* ══════════════════════════════════════
   HIDE GP BACK TO TOP — not needed
   ══════════════════════════════════════ */
.generate-back-to-top {
    display: none !important;
}
/* ── A11y: visible keyboard focus + reduced motion ── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--fx-accent);
    outline-offset: 2px;
    border-radius: 2px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
