
/* =======================================================
   ACTION NEWS — HEADER + LAYOUT
   Slick, compact, professional news header.
   Desktop: thin multi-row bar, logo + nav + search in one tight row.
   Mobile: compact top bar, full-screen hamburger menu, sticky bottom nav.
======================================================= */

:root {
  --brand-blue: #0a50c2;
  --brand-blue-dark: #083d96;
  --brand-blue-light: #1a6cf0;
  --accent-red: #e53935;
  --header-text: #fff;
  --h-topbar: 22px;
  --h-main: 40px;
  --h-secnav: 0px;
  --h-ticker: 22px;
  --h-title: 0px;
  --content-offset: calc(var(--h-topbar) + var(--h-main) + var(--h-secnav) + var(--h-ticker) + var(--h-title));
  --header-radius: 0;
}

/* Reset / base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--content-offset); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale; }
body { font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f4f5f7; color: #1a1a1a; overflow-x: hidden; transition: background-color .3s ease, color .3s ease; }
body.dark-mode { background: #0a0a0a; color: #e0e0e0; }
a { color: #1a73e8; text-decoration: none; transition: color .2s ease; }
a:hover { color: #0c47b7; text-decoration: underline; }

/* Helper */
.with-fixed-header { margin-top: var(--content-offset) !important; }

/* ---- HEADER STACK ---- */
.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: var(--brand-blue); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.top-bar, .main-header, .secondary-nav, .news-ticker { background: var(--brand-blue); color: var(--header-text); }
.top-bar a, .main-header a, .secondary-nav a, .news-ticker a { color: #fff; }

/* ---- TOP BAR (slim utility row) ---- */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1006;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(10px, 2vw, 20px);
  font-size: 0.7em; white-space: nowrap; overflow: hidden;
  min-height: var(--h-topbar);
  background: var(--brand-blue-dark);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.top-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.top-left a { opacity: .85; transition: opacity .2s; }
.top-left a:hover { opacity: 1; text-decoration: none; }
.top-center {
  flex: 1; text-align: center; font-weight: 600; color: #fff;
  font-size: 0.88em; letter-spacing: .02em;
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions a { opacity: .85; transition: opacity .2s; font-weight: 500; }
.top-actions a:hover { opacity: 1; text-decoration: none; }
.top-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.top-right a { opacity: .8; font-size: 1em; transition: opacity .2s, transform .2s; display: inline-flex; }
.top-right a:hover { opacity: 1; transform: scale(1.15); text-decoration: none; }
.icon-btn { background: transparent; border: 0; color: #fff; cursor: pointer; transition: opacity .2s, transform .2s; font-size: 1em; opacity: .85; display: inline-flex; align-items: center; }
.icon-btn:hover { opacity: 1; transform: scale(1.15); }
.hamburger { background: transparent; border: 0; color: #fff; display: none; font-size: 1.2em; cursor: pointer; transition: transform .2s ease; padding: 4px; }
.hamburger:hover { transform: scale(1.1); }
.pipe { margin: 0 4px; font-size: 0.85em; opacity: .7; }

/* ---- MAIN HEADER (brand + nav + search) ---- */
.main-header {
  position: fixed; top: var(--h-topbar); left: 0; right: 0; z-index: 1005;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 clamp(10px, 2vw, 20px);
  min-height: var(--h-main);
  background: var(--brand-blue);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.3));
  transition: border-color .3s, transform .3s;
}
.brand:hover img { border-color: rgba(255,255,255,.6); transform: scale(1.05); }
.logo-text {
  font-family: 'Playfair Display', Georgia, serif; font-weight: 900;
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  letter-spacing: .02em; line-height: 1; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}

/* ---- PRIMARY NAV ---- */
.primary-nav { flex: 1; display: flex; justify-content: center; align-items: center; }
.primary-nav ul { list-style: none; display: flex; align-items: center; gap: 2px; }
.primary-nav li { position: relative; }
.primary-nav a {
  font-weight: 500; font-size: 0.85em;
  padding: 6px 10px; border-radius: 6px;
  transition: background .2s, color .15s;
  display: inline-flex; align-items: center; gap: 4px;
}
.primary-nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.primary-nav .dropdown-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 150px;
  background: var(--brand-blue-dark); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 1015;
  padding: 6px 0;
}
.primary-nav li:hover > .dropdown-menu { display: block; }
.dropdown-menu li { width: 100%; border-bottom: none; }
.dropdown-menu a { display: block; padding: 8px 14px; color: #fff; font-size: .85em; border-radius: 0; }
.dropdown-menu a:hover { background: rgba(255,255,255,.1); }

/* ---- SEARCH ---- */
.search-bar { flex-shrink: 0; display: flex; align-items: center; position: relative; }
.search-bar form { display: flex; align-items: center; width: 100%; max-width: 220px; }
.search-bar input[type="text"] {
  flex: 1; padding: 6px 12px; border: none;
  border-radius: 20px 0 0 20px;
  background: rgba(255,255,255,.15); color: #fff; outline: none;
  font-size: 0.85em; transition: background .2s, width .3s;
  -webkit-appearance: none;
}
.search-bar input[type="text"]::placeholder { color: rgba(255,255,255,.6); }
.search-bar input[type="text"]:focus { background: rgba(255,255,255,.25); }
.search-bar button {
  padding: 6px 12px; border: 0;
  background: var(--brand-blue-light); color: #fff;
  border-radius: 0 20px 20px 0; cursor: pointer;
  transition: background .2s;
}
.search-bar button:hover { background: var(--brand-blue-dark); }

/* ---- SECONDARY NAV (hidden on desktop — items merged into primary nav) ---- */
.secondary-nav {
  position: fixed; top: calc(var(--h-topbar) + var(--h-main)); left: 0; right: 0; z-index: 1003;
  display: none; align-items: center; justify-content: center;
  padding: 0 clamp(10px, 2vw, 20px);
  min-height: 0;
  background: var(--brand-blue);
  border-top: 1px solid rgba(255,255,255,.06);
}
.secondary-nav ul {
  list-style: none; display: flex; gap: 6px;
  align-items: center; font-size: 0.78em; justify-content: center;
}
.secondary-nav a {
  padding: 3px 10px; border-radius: 12px;
  transition: background .2s; font-weight: 500;
}
.secondary-nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }

/* Inline secondary nav items (in primary nav on desktop) */
.secnav-inline { border-left: 1px solid rgba(255,255,255,.15); margin-left: 4px; padding-left: 4px; }
.secnav-inline a { font-size: .8em; opacity: .85; }
.secnav-inline a:hover { opacity: 1; }
.live-indicator {
  display: inline-flex; align-items: center;
  background: var(--accent-red); color: #fff;
  padding: 2px 8px; border-radius: 12px;
  font-size: 0.75em; font-weight: 600; letter-spacing: .03em;
  list-style: none;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff; margin-right: 4px;
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .6; transform: scale(1.4); }
}

/* ---- TICKER ---- */
.news-ticker {
  position: fixed; top: calc(var(--h-topbar) + var(--h-main) + var(--h-secnav)); left: 0; right: 0; z-index: 1002;
  padding: 0 clamp(10px, 2vw, 20px);
  background: var(--brand-blue-dark);
  border-top: 1px solid rgba(255,255,255,.06);
  overflow: hidden; font-size: 0.76em;
  min-height: var(--h-ticker); display: flex; align-items: center;
  cursor: grab; user-select: none;
}
.news-ticker:active { cursor: grabbing; }
.news-ticker ul { display: flex; gap: 20px; list-style: none; white-space: nowrap; will-change: transform; }
.news-ticker ul li { display: flex; align-items: center; }
.news-ticker ul li::before { content: ''; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.4); margin-right: 8px; flex-shrink: 0; }
.news-ticker ul a { transition: opacity .2s; }
.news-ticker ul a:hover { opacity: .8; text-decoration: none; }

/* ---- TITLE AREA ---- */
.title-area {
  position: fixed; top: calc(var(--h-topbar) + var(--h-main) + var(--h-secnav) + var(--h-ticker)); left: 0; right: 0; z-index: 1001;
  background: var(--brand-blue); color: #fff; text-align: center;
  padding: 4px clamp(10px, 2vw, 20px); font-size: .9em; font-weight: 500;
  display: none; word-break: break-word; overflow: hidden; text-overflow: ellipsis; white-space: normal;
}
.title-area:not(:empty) { display: block; }

/* ============ RESPONSIVE ============ */

/* Desktop wide */
@media (min-width: 993px) {
  .primary-nav ul { gap: 2px; }
  .secondary-nav { display: none !important; }
  .secnav-inline { display: list-item; }
}

/* Tablet */
@media (max-width: 992px) {
  .logo-text { display: none; }
  .hamburger { display: inline-flex; font-size: 1.4em; }
  .top-bar { font-size: 0.68em; padding: 0 8px; }
  .top-actions { display: none; } /* move to hamburger menu */
  .top-center { font-size: 0.82em; }
  .top-right { gap: 5px; }
  .main-header { padding: 0 8px; gap: 6px; }
  .search-bar form { max-width: 160px; }
  .secondary-nav { display: none; }
  .secnav-inline { display: none !important; }
  .news-ticker { padding: 0 8px; font-size: 0.72em; }

  /* Mobile flyout nav */
  .primary-nav {
    position: fixed; top: calc(var(--h-topbar) + var(--h-main));
    left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
    z-index: 1007; display: none;
    justify-content: flex-end;
  }
  .primary-nav.active { display: flex; }
  .primary-nav ul {
    flex-direction: column; gap: 0;
    background: var(--brand-blue-dark);
    width: 280px; max-width: 80vw;
    margin-left: auto;
    padding: 12px 0;
    max-height: calc(100vh - var(--h-topbar) - var(--h-main));
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0,0,0,.3);
    border-radius: 0;
  }
  .primary-nav li { width: 100%; border-bottom: 1px solid rgba(255,255,255,.06); }
  .primary-nav a { padding: 14px 20px; font-size: 1em; border-radius: 0; display: flex; align-items: center; }
  .primary-nav .dropdown-menu { position: static; display: none; background: rgba(0,0,0,.15); box-shadow: none; padding: 0; border-radius: 0; }
  .primary-nav .dropdown.active .dropdown-menu { display: block; }
  .primary-nav .dropdown-menu a { padding: 12px 20px 12px 36px; font-size: .92em; }
}

/* Tablet (mid): show Canada + World inline */
@media (min-width: 481px) and (max-width: 992px) {
  .primary-nav { position: fixed; display: none; } /* keep hidden until hamburger */
  .primary-nav.active { display: flex; }
  .hamburger { margin-left: 4px; }
}

/* Phone */
@media (max-width: 480px) {
  :root { --h-topbar: 24px; --h-main: 40px; --h-ticker: 20px; }
  .brand img { width: 30px; height: 30px; }
  .hamburger { font-size: 1.5em; }
  .top-center { font-size: 0.75em; }
  .top-left { display: none; } /* Home/WebMail in bottom nav instead */
  .search-bar form { max-width: 120px; }
  .search-bar input[type="text"] { padding: 5px 8px; font-size: .8em; }
  .search-bar button { padding: 5px 8px; }
}

/* ---- DARK MODE EXTRAS ---- */
body.dark-mode .search-bar input[type="text"] { background: rgba(255,255,255,.1); }
body.dark-mode #search-suggestions { background: #1a1a1a !important; border-color: #333 !important; }
body.dark-mode #search-suggestions a { color: #ddd !important; }
body.dark-mode #search-suggestions li { border-bottom-color: #333 !important; }
body.dark-mode #search-suggestions a:hover { background: #222 !important; }
body.dark-mode .featured-overlay { background: linear-gradient(transparent, rgba(0,0,0,.88)); }
body.dark-mode .article-time { color: #777; }

/* ---- NOTIFICATION BELL ---- */
#notify-toggle { position: relative; }
#notify-toggle .fa-bell, #notify-toggle .fa-bell-slash { transition: color .2s, transform .2s; }
#notify-toggle:hover .fa-bell { transform: rotate(15deg); }

/* ---- CONTENT / FOOTER ---- */
.container { max-width: 100%; margin: 0 auto; }
.main-content { max-width: 1200px; margin: var(--content-offset) auto 20px; padding: 0 15px; overflow: hidden; }
.main-content img, .main-content iframe, .main-content video { max-width: 100%; height: auto; }
footer { background: #fff; padding: 15px; border-top: 1px solid #e0e0e0; text-align: center; color: #000; margin-top: 60px; }
body.dark-mode footer { background: #111; border-top: 1px solid #222; color: #ccc; }

/* ---- MOBILE BOTTOM NAV ---- */
.mobile-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 2000;
  background: var(--brand-blue); display: none;
  justify-content: space-around; align-items: center;
  padding: 4px 0 max(4px, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0,0,0,.25);
  border-top: 1px solid rgba(255,255,255,.1);
}
.mobile-bottom-nav a {
  color: #fff; text-decoration: none; font-size: 0.6em;
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 1px; padding: 4px 8px;
  opacity: .75; transition: opacity .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-bottom-nav a:hover, .mobile-bottom-nav a.active { opacity: 1; transform: translateY(-1px); text-decoration: none; }
.mobile-bottom-nav i { font-size: 1.35em; }
@media (max-width: 600px) {
  .mobile-bottom-nav { display: flex; }
  body { padding-bottom: 52px !important; }
  footer { margin-bottom: 52px; }
}
@media (min-width: 601px) {
  .mobile-bottom-nav { display: none; }
}