/*
  SignalWeek – style.css
  © 2025 SignalWeek. All Rights Reserved.

  Licensed under the MIT License.
  https://signalweek.com/license.html

  Unauthorized use or redistribution prohibited.
*/

/* style.css */

/* ─────────────────────────────────────────────────────────────────
   BODY & BASE STYLES
   ───────────────────────────────────────────────────────────────── */
   body {
    margin: 0;
    padding: 0;
    background: #191E2B;            /* site background = #191E2B */
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #f0f3f7;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;              /* fill at least one viewport height */
  }
  
  /* ─────────────────────────────────────────────────────────────────
     FULL-WIDTH HEADER BAR (BANNER)
     ───────────────────────────────────────────────────────────────── */
  .header-bar {
    width: 100%;
    background-color: #252D39;
    position: relative;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     CONTENT INSIDE HEADER: CSS Grid with three columns
     (left, center, right). Spans full viewport to hug edges.
     ───────────────────────────────────────────────────────────────── */
  .header-content {
    width: 100%;                  /* span full header-bar */
    display: grid;
    /* ← make left and right "flex" equally, center column auto-width */
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 16px 48px;                /* your standard gutters */
    gap: 16px;
    box-sizing: border-box;       /* include padding in width */
    position: relative;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     LEFT SECTION: just calendar logo + site brand
     ───────────────────────────────────────────────────────────────── */
  .header-left {
    display: flex;
    align-items: center;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     NEW: permanent "About" link styling
     ───────────────────────────────────────────────────────────────── */
  .header-link {
    font-size: 0.9rem;
    color: #f0f3f7;
    text-decoration: none;
    margin-right: 16px;   /* space before the TZ selector */
    transition: color 0.2s ease;
  }
  .header-link:hover {
    color: #ff6b00;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     CENTER SECTION: "Weekly Economic & Earnings Calendar"
     • placed in the center grid cell and truly centered
     ───────────────────────────────────────────────────────────────── */
  .homepage-title {
    justify-self: center;
    font-size: 1.2rem;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     RIGHT SECTION: Time Zone dropdown
     • placed in the rightmost grid cell, flush against right padding
     ───────────────────────────────────────────────────────────────── */
  .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
  }
  
  /* "Time Zone:" label (slightly bold) */
  .tz-label {
    font-size: 0.9rem;
    color: #ccd2e3;
    font-weight: 500;
  }
  
  /* Restyled Time Zone dropdown (dark pill style) */
  .tz-dropdown {
    background-color: #1a1e2c;       /* dark background */
    color: #f0f3f7;
    border: 1px solid #444c6b;       /* slightly purple border */
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }
  .tz-dropdown:hover {
    background-color: #2a2f45;
    border-color: #ff6b00;           /* accent on hover/focus */
  }
  .tz-dropdown:focus {
    outline: none;
    border-color: #ff6b00;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     MAIN CONTAINERS
     ───────────────────────────────────────────────────────────────── */
  .container {
    width: 100%;
    max-width: 1150px;
    flex: 1;                         /* <— ensures it expands to push footer down */
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  /* Push calendar section down just under header-content */
  .calendar-container {
    margin-top: 24px;
    margin-bottom: 12px;  /* Match the spacing of the affiliate banner */
  }
  
  /* ─────────────────────────────────────────────────────────────────
     FILTER SECTION
     ───────────────────────────────────────────────────────────────── */
  .controls {
    display: flex;
    align-items: center;            /* align label and buttons horizontally */
    gap: 12px;
    margin-bottom: 8px;             /* extra space below the filters */
  }
  .filter-label {
    font-size: 0.9rem;
    color: #ffffff;
    font-weight: 500;
  }
  .filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
  }
  
  /* Top-level filter buttons (icon + text) */
  .filter-group .filter-toggle {
    padding: 3px 14px;
    font-size: 0.85rem;         /* show text */
    font-weight: 400;
    color: #ffffff;             /* force text to pure white */
    background-color: #1a1e2c;  /* default dark background when not active */
    border: 2px solid var(--color);
    border-radius: 6px;         /* reduced rounding */
    cursor: pointer;
    display: inline-flex;       /* allows flex alignment inside */
    align-items: center;        /* vertically center icon + text */
    gap: 6px;                   /* small gap between icon and text */
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  .filter-group .filter-toggle img.filter-icon {
    width: 16px;
    height: 16px;
  }
  .filter-group .filter-toggle.active {
    background-color: var(--color); /* use the inline --color value for active */
    color: #ffffff;                  /* ensure active text stays white */
  }
  
  /* "All | None" links */
  .filter-allnone-container {
    display: inline-flex;
    align-items: center;
    margin-left: 16px;              /* space between filter buttons and "All | None" */
  }
  
  .filter-allnone {
    font-size: 0.9rem;
    color: #ccd2e3;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
  }
  
  .filter-allnone:hover {
    color: #ffffff;
  }
  
  .filter-allnone-separator {
    font-size: 0.9rem;
    color: #606973;
    user-select: none;
    margin: 0 16px
  }
  
  /* ─────────────────────────────────────────────────────────────────
     NEXT EVENT BANNER (with three-color gradient)
     ───────────────────────────────────────────────────────────────── */
  .next-event-banner {
    width: 100%;
    background: linear-gradient(
      to right,
      #325BF1 0%,
      #6747F1 50%,
      #8927F0 100%
    );
    border-radius: 8px;
    margin-bottom: 4px;  /* reduced from 12px to 4px */
    overflow: hidden;
    padding: 12px 20px;  /* adjusted to match production */
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid #2F3847;
    min-height: 44px;  /* adjusted to match production */
    display: flex;
    align-items: center;
  }
  
  /* New Affiliate Banner */
  .affiliate-banner {
    width: 100%;
    background: #2A303A;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    padding: 12px 20px;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid #2F3847;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .affiliate-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .affiliate-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #ffffff;
  }
  
  .affiliate-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
  }
  
  .tab-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    position: relative;
  }
  
  .tab-default {
    opacity: 1;
    transition: opacity 0.2s ease;
  }
  
  .tab-hover {
    position: absolute;
    right: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  
  .affiliate-link:hover .tab-default {
    opacity: 0;
  }
  
  .affiliate-link:hover .tab-hover {
    opacity: 1;
  }
  
  .affiliate-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #649EFC;
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
  }
  
  .affiliate-link:hover {
    color: #ff6b00;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     CALENDAR GRID
     ───────────────────────────────────────────────────────────────── */
  #calendar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(217px, 1fr));
    gap: 16px;
  }
  .day {
    background: #252D39;
    border: 1px solid #353C4B;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  }
  .day.today-column {
    border: 2px solid #6CC94F;
    padding: 14px; /* adjust padding to account for border width */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  }
  
  /* Updated heading layout to stack weekday over date */
  .day h3 {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    gap: 4px; /* small vertical gap between weekday and date */
  }
  
  /* Weekday: smaller, lighter color */
  .weekday {
    font-size: 0.8rem;
    color: #ccd2e3;
    font-weight: 500;
    text-transform: uppercase;
  }
  
  /* Date: larger, white */
  .date {
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 600;
  }
  
  /* Highlight "today" with green for both lines */
  .current-day .weekday {
    color: #6CC94F;
  }
  .current-day .date {
    color: #6CC94F;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     "NEXT" HIGHLIGHT
     ───────────────────────────────────────────────────────────────── */
  .next {
    border: 2px solid #63A4F7;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     EVENT & EARNINGS BLOCKS (REPLACED with test_redesign styles)
     ───────────────────────────────────────────────────────────────── */
  
  /* Base block styling (all blocks share background #3B4250) */
  .block {
    background: #3B4250;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;         /* let the grid column control actual width */
    box-sizing: border-box;
  }
  
  /* Earnings block styling */
  .earnings {
    background: #3B4250;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;                /* only earnings get pointer cursor */
    transition: background 0.2s ease;
  }
  .earnings:hover {
    background: #4C5360;
  }
  
  /* Header row for each block: icon-pill + time */
  .block-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }
  
  /* Pill buttons inside each block → icon only */
  .block-header .filter-toggle {
    padding: 3px 4px;
    font-size: 0;                      /* hide text inside block */
    background-color: #1a1e2c;
    border: 2px solid var(--color);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }
  .block-header .filter-toggle.active {
    background-color: var(--color);
    border-color: var(--color);
  }
  .block-header .filter-icon {
    width: 16px;
    height: 16px;
  }
  
  .block-header .time {
    font-weight: 600;
    font-size: 0.85rem;
    color: #f5f7fa;
    white-space: nowrap;
    margin-left: 8px;
  }
  
  /* Title styling */
  .title-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    line-height: 1.0;
    margin-bottom: 0;
  }
  
  .title-text {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
    line-height: 1.0;
  }
  
  .price-text {
    font-weight: 600;
    font-size: 0.95rem;
    color: #ccd2e3;
    white-space: nowrap;
    line-height: 1.0;
  }
  
  .ticker-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    line-height: 1.0;
    margin-bottom: 4px;
  }
  
  .ticker-text {
    font-weight: 600;
    font-size: 0.95rem;
    color: #ffffff;
    line-height: 1.0;
  }
  
  .percent-change {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    line-height: 1.0;
  }
  
  .percent-change.positive {
    color: #00C805;
  }
  
  .percent-change.negative {
    color: #FF5000;
  }
  
  .percent-change.neutral {
    color: #ccd2e3;
  }
  
  /* Description / sentiment */
  .sentiment {
    font-size: 0.75rem;
    color: #ccd2e3;
  }
  
  /* Forecast/Prev/Cons or EPS details */
  .details {
    font-size: 0.75rem;
    color: #ccd2e3;
  }
  .details .label {
    color: #ccd2e3;
  }
  .details .value {
    color: #ffffff;
    font-weight: 600;
  }
  
  /* Separator for earnings block */
  .separator {
    width: 100%;
    height: 1px;
    background-color: #4D5563;
    margin: 8px 0 4px 0;
  }
  
  /* "Click to view stock chart" text */
  .chart-link {
    font-size: 0.75rem;
    color: #649EFC;
    transition: text-decoration 0.2s ease;
  }
  .chart-link:hover {
    text-decoration: none;
  }
  
  /* Change separator color on hover of earnings */
  .earnings:hover .separator {
    background-color: #697088;
  }
  
  /* ─────────────────────────────────────────────────────────────────
     TRADINGVIEW FOOTER (at bottom of content via flex logic)
     ───────────────────────────────────────────────────────────────── */
  .tv-footer {
    width: 100%;                /* span the full viewport width */
    background: #191E2B;        /* match page background */
    box-sizing: border-box;
    margin-top: 16px;           /* small gap above ticker if desired */
  }
  
  .tradingview-widget-container {
    width: 100%;                /* ensure container is full width */
  }
  
  .tradingview-widget-container__widget {
    width: 100%;                /* force the iframe to expand */
    min-height: 50px;           /* adjust if you need a taller ticker */
  }
  
  .tradingview-widget-container iframe {
    width: 100% !important;     /* override any inline width */
    max-width: 100%;
    display: block;             /* remove inline behavior */
  }
  
  /* ─────────────────────────────────────────────────────────────────
     Responsive Adjustments
     ───────────────────────────────────────────────────────────────── */
  @media (max-width: 600px) {
    /* Hide header title, timezone filter, filter label, and All|None links */
    .homepage-title,
    .header-right,
    .filter-label,
    .filter-allnone-container {
      display: none;
    }
  
    .header-content {
      display: flex;               
      flex-direction: column;
      align-items: flex-start;
      gap: 8px;
      padding: 12px 0;
    }
  
    .tz-dropdown {
      width: 100%;
    }
  
    .calendar-container {
      margin-top: 12px;
    }
  
    /* Stack the filter label above the buttons on very small screens */
    .controls {
      flex-direction: column;
      align-items: flex-start;
    }
    .filter-group {
      width: 100%;
      justify-content: flex-start;
    }
  
    /* Make the TradingView popup a shorter, wide rectangle */
    .modal-frame {
      width: 100vw !important;
      max-width: none;
      height: 65vh !important;      /* give a bit more height */
      max-height: none;
      border-radius: 0;
      padding: 0;                    /* remove all inner padding */
      box-sizing: border-box;
    }
  
    /* Remove any padding inside the chart container */
    .modal-content {
      flex: 1;
      padding: 0 !important;
    }
  
    /* Ensure the widget stretches to fill its container */
    #modal-chart-area,
    .tradingview-widget-container,
    .tradingview-widget-container__widget {
      width: 100% !important;
      height: 100% !important;
      margin: 0;
    }
  
    /* Hide the "Live data" indicator completely */
    .modal-header .live-text,
    .modal-header .live-dot {
      display: none;
    }
  }
  
  /* ─────────────────────────────────────────────────────────────────
     MODAL STYLES FOR TRADINGVIEW POPUP
     ───────────────────────────────────────────────────────────────── */
  
  /* Overlay covers entire viewport; hidden by default */
  .modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent; /* no dimming */
    justify-content: center;
    align-items: center;
    z-index: 1000;
  }
  .modal-overlay.active {
    display: flex; /* shows the overlay as a centered flex container */
  }
  
  /* The "frame" or "window" inside the overlay */
  .modal-frame {
    background: #252D39;
    border: 1px solid #3A4251;   /* 1px border */
    border-radius: 8px;
    padding: 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 80%;
    max-width: 1000px;
    height: 80%;
    max-height: 800px;
    position: relative; /* to position the close button */
  }
  
  /* Close button in top-right corner */
  .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;      /* match your PNG size */
    height: 24px;
    padding: 0;
    border: none;
    background: url("assets/logos/close.png") no-repeat center/contain;
    cursor: pointer;
    z-index: 10;
  }
  
  .modal-close:hover {
    background-image: url("assets/logos/close_hover.png");
  }
  
  /* Header inside the frame, containing stock name + "live" indicator */
  .modal-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
  }
  
  /* Container for stock name + live dot in one line */
  .stock-name-live {
    display: flex;
    align-items: center;
  }
  .modal-header .stock-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    margin-right: 12px; /* spacing between name & live dot */
  }
  /* "Live data" indicator */
  .live-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 0.95rem;
    color: #ffffff; /* text white */
  }
  .live-indicator .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #A5F084; /* green dot */
    margin-right: 4px;
  }
  .modal-header .stock-subtitle {
    font-size: 0.85rem;
    color: #ccd2e3;
    margin-top: 4px;
  }
  
  /* The content area (holds the TradingView widget iframe) */
  .modal-content {
    flex: 1;
    background: #0f111a;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  /* Force the widget container to fill the content area */
  #modal-chart-area {
    width: 100%;
    height: 100%;
  }
  
  /* make the wrapper flex and clickable */
  .home-link {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
  }
  
  /* calendar logo as before */
  .calendar-logo {
    width: 24px;
    height: 24px;
    background: url("assets/logos/calendar.png") no-repeat center/contain;
    transition: none;
  }
  
  /* brand text */
  .site-brand {
    font-size: 1.2rem;
    font-weight: 600;
    color: #f0f3f7;
    transition: none;
  }
  
  /* on hover of either, swap icon & text color */
  .home-link:hover .site-brand {
    color: #ff6b00;
  }
  
  .site-footer {
    text-align: center;
    padding: 12px 0 12px 0;  /* Increased top padding to 24px while keeping bottom at 6px */
    margin: 0;
    font-size: 0.75rem;
    color: #ffffff;
  }
  
  .site-footer p {
    margin: 0;            /* kill default <p> margins */
  }
  
  .site-footer .footer-link {
    color: #ffffff;       /* white link */
    text-decoration: none;
    transition: color 0.2s ease;
  }
  
  .site-footer .footer-link:hover {
    color: #ff6b00;       /* SignalWeek orange on hover */
  }
  
  
  /* ─────────────────────────────────────────────────────────────────
     Next-Event Banner Fade Overlay
     ───────────────────────────────────────────────────────────────── */
  #next-event-banner {
    position: relative;
    overflow: hidden;
    min-height: 44px;
  }
  
  #next-event-banner > div {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
  }
  
  #next-event-banner > .visible {
    opacity: 1;
    pointer-events: auto;
  }
  
  /* Affiliate link in the banner */
  #next-event-banner #affiliate a {
    color: #ffffff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  #next-event-banner #affiliate a:hover {
    color: #B2EBF2;
  }
  #next-event-banner #affiliate a img.external-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    position: relative;
    top: 0px;           /* push it down 2px—you can tweak this value */
    vertical-align: middle;
  }
  
  /* Make the countdown container align icon + text */
  #countdown {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;  /* adjusted to match production */
    color: #ffffff;
  }
  
  /* Style the clock icon */
  #countdown .clock-icon {
    width: 16px;
    height: 16px;
  }
  
  /* ========================================================================================
     when showing ONLY the TradingView widget (no custom header/content styling)
     ======================================================================================== */
  .modal-frame.simple-chart {
    /* size it to 70% of the viewport, capped at reasonable dimensions */
    width: 85vw;
    height: 75vh;
    max-width: 1000px;
    max-height: 600px;
    /* center in viewport */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0;           /* you already removed inner wrappers */
    border-radius: 8px;
    overflow: hidden;
    background: #252D39;  /* matches site theme */
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  }
  
  /* Make the chart fill all of it */
  .modal-frame.simple-chart #modal-chart-area {
    width: 100%;
    height: 100%;
  }
  
  /* Reposition the close button inside the corner of this frame */
  .modal-frame.simple-chart .modal-close {
    position: absolute;  /* overlay on the chart */
    top: 8px;
    right: 8px;
    z-index: 10;
  }
  
  /* hide any leftover header or content styling */
  .simple-chart .modal-header,
  .simple-chart .modal-content {
    display: none !important;
  }
  