/* ============================================================
   LAYOUT - Header, Navigation, Sidebar, Grid
   ============================================================ */

/* ── Header ── */
header { 
  background: var(--espn-blue); 
  color: #fff; 
  padding: 0 24px; 
  display: flex; 
  align-items: center; 
  height: 48px; 
  position: sticky; 
  top: 0; 
  z-index: 1000; 
  box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
  border-radius: 12px 0 0 0; 
  margin-top: 10px; 
  width: calc(100% - 1px); 
  margin-left: 1px; 
  gap: 15px; /* Increased gap for better spacing */
}

/* ── Branding ── */
.brand { 
  display: flex; 
  align-items: center; 
  text-decoration: none; 
  margin-right: 20px; 
  flex-shrink: 0; 
  z-index: 1001; 
}

.logo-text { 
  font-size: 26px; 
  font-weight: 900; 
  letter-spacing: -2px; 
  text-transform: uppercase; 
  line-height: 1; 
  font-style: italic; 
}

.logo-text span { 
  color: #fff; 
  background: var(--accent-red); 
  padding: 0 2px; 
}

.logo-text em { 
  color: var(--whitish-blue); 
  font-style: italic; 
  font-weight: 500; 
  text-transform: lowercase; 
  margin-left: 1px; 
}

/* ── Navigation Tabs ── */
.nav-tabs { 
  display: flex; 
  height: 100%; 
  align-items: center; 
  overflow-x: auto; 
  scrollbar-width: none; 
  flex: 1; 
  justify-content: flex-start; /* Aligned left to give clock more room */
}

.nav-tabs::-webkit-scrollbar { display: none; }

.tab { 
  height: 100%; 
  display: flex; 
  align-items: center; 
  padding: 0 14px; 
  font-size: 14px; 
  font-weight: 700; 
  color: rgba(255,255,255,0.7); 
  cursor: pointer; 
  text-transform: none; 
  white-space: nowrap; 
  transition: 0.2s; 
  border-bottom: 3px solid transparent; 
}

.tab:hover { color: #fff; }
.tab.active { 
  color: #fff; 
  border-bottom-color: #fff; 
  background: rgba(0,0,0,0.15); 
}

/* ── Clock Display (FIXED WIDTH) ── */
#clockDisplay { 
  font-size: 11px; 
  color: rgba(255,255,255,0.9); 
  font-weight: 700; 
  white-space: nowrap; 
  min-width: 120px; /* Forces enough space for "31 Mar · 09:30" */
  text-align: right;
  flex-shrink: 0; /* Prevents the clock from being squashed */
  margin-left: 10px;
}

/* ── Dark Mode Toggle ── */
.dark-toggle {
  width: 36px; 
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex; 
  align-items: center; 
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
  z-index: 1001;
  margin-left: 5px;
}

.dark-toggle:hover { 
  background: rgba(255,255,255,0.2); 
  border-color: rgba(255,255,255,0.6); 
}

/* ── Hamburger Menu ── */
.hamburger { 
  display: none; 
  flex-direction: column; 
  gap: 4px; 
  cursor: pointer; 
  padding: 8px; 
  z-index: 1001; 
}

.hamburger div { 
  width: 22px; 
  height: 3px; 
  background: #fff; 
  border-radius: 2px; 
  transition: 0.3s; 
}

.hamburger.active .line1 { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active .line2 { opacity: 0; }
.hamburger.active .line3 { transform: rotate(-45deg) translate(5px, -5px); }

/* ── Mobile Menu ── */
.mobile-menu { 
  position: fixed; 
  top: 58px; 
  right: 1px; 
  width: 240px; 
  height: auto; 
  max-height: calc(100vh - 70px);
  background: var(--espn-blue); 
  z-index: 1000; 
  display: none; 
  flex-direction: column; 
  border-radius: 0 0 0 16px; 
  box-shadow: -5px 5px 20px rgba(0,0,0,0.3);
  overflow-y: auto; 
  padding: 10px 0;
  border: 1px solid rgba(255,255,255,0.1);
}

.mobile-menu.active { 
  display: flex; 
  animation: slideIn 0.3s ease-out; 
}

@keyframes slideIn { 
  from { transform: translateX(20px); opacity: 0; } 
  to { transform: translateX(0); opacity: 1; } 
}

.mobile-tab { 
  color: #fff; 
  font-size: 16px; 
  font-weight: 700; 
  padding: 14px 24px; 
  text-decoration: none; 
  cursor: pointer; 
  text-transform: none; 
  border-bottom: 1px solid rgba(255,255,255,0.05); 
  text-align: left; 
  width: 100%; 
}

.mobile-tab:hover { background: rgba(255,255,255,0.1); }
.mobile-tab.active { 
  color: var(--yell); 
  background: rgba(0,0,0,0.1); 
}

/* ── Main Layout ── */
.layout-box { flex: 1; width: 100%; }

.layout { 
  display: flex; 
  max-width: 1400px; 
  margin: 0 auto; 
  padding: 25px 24px; 
  gap: 12px; 
  align-items: flex-start; 
}

.main-pane { flex: 3; min-width: 0; }

.section-label { 
  font-size: 19px; 
  font-weight: 800; 
  text-transform: uppercase; 
  border-left: 6px solid var(--espn-blue); 
  padding-left: 14px; 
  margin-bottom: 15px; 
}

/* ── Grid ── */
#output { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); 
  gap: 12px; 
}

/* ── Sidebar ── */
.sidebar { 
  width: 340px; 
  flex-shrink: 0; 
  display: flex; 
  flex-direction: column; 
  gap: 12px; 
  align-self: stretch; 
}

.sidebar-section { 
  background: var(--surface); 
  border: 1px solid var(--border2); 
  border-radius: 14px; 
  overflow: hidden;
  box-shadow: 0 2px 6px var(--shadow);
  transition: all 0.3s ease;
}

.sidebar-section:hover {
  box-shadow: 0 4px 12px var(--shadow2);
}

.sticky-widget { 
  position: sticky; 
  top: 58px; 
  z-index: 100; 
  align-self: flex-start; 
}

.sidebar-title { 
  border-top: 4px solid var(--espn-blue); 
  padding: 14px 18px; 
  font-size: 14px; 
  font-weight: 800; 
  text-transform: uppercase; 
  background: var(--surface2); 
  border-bottom: 1px solid var(--border); 
}

.trending-container { 
  height: 420px; 
  overflow: hidden; 
}

.trending-track { 
  display: flex; 
  flex-direction: column; 
  animation: scrollVertical 35s linear infinite; 
}

@keyframes scrollVertical {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.sidebar-article { 
  display: flex; 
  gap: 14px; 
  padding: 12px 18px; 
  border-bottom: 1px solid var(--border); 
  text-decoration: none; 
  color: inherit; 
  align-items: center;
  transition: background 0.2s;
}

.sidebar-article:hover {
  background: var(--surface2);
}

.sidebar-thumb { 
  width: 140px; 
  height: 105px; 
  object-fit: cover; 
  flex-shrink: 0; 
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
  border-radius: 10px;
  box-shadow: 0 2px 4px var(--shadow);
}

.sidebar-headline { 
  font-size: 13.5px; 
  font-weight: 700; 
  line-height: 1.3; 
  margin-bottom: 5px; 
}

.sidebar-source { 
  font-size: 10px; 
  color: var(--espn-blue); 
  font-weight: 800; 
  text-transform: uppercase; 
}

/* ── Footer ── */
footer { 
  padding: 15px 24px; 
  background: var(--footer-bg); 
  border-top: 1px solid var(--footer-border); 
  text-align: center; 
  margin-top: auto; 
}

.disclaimer { 
  font-size: 11px; 
  color: var(--footer-text); 
  font-weight: 700; 
  max-width: 900px; 
  margin: 0 auto; 
  line-height: 1.4; 
  letter-spacing: 0.1px; 
}

/* ── Back to Top Button ── */
#backToTop { 
  position: fixed; 
  bottom: 30px; 
  right: 16px; 
  width: 36px; 
  height: 36px; 
  background: var(--espn-blue); 
  color: white; 
  border: none; 
  border-radius: 50%; 
  display: none; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  z-index: 1000; 
  font-size: 16px; 
  font-weight: 800; 
  box-shadow: 0 3px 12px rgba(3,91,176,0.4); 
  transition: all 0.3s ease;
  opacity: 0;
}

#backToTop.visible { display: flex; opacity: 1; }
#backToTop:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 6px 16px rgba(3,91,176,0.5); 
}

/* ── Responsive - Mobile ── */
@media(max-width:600px){
  header {
    transition: transform 0.35s ease;
  }
  header.hidden {
    transform: translateY(-100%);
  }
  
  .float-menu {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 16px;
    width: 44px; 
    height: 44px;
    background: var(--espn-blue);
    border-radius: 50%;
    z-index: 1001;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(3,91,176,0.4);
    transition: all 0.3s ease;
    opacity: 0;
  }
  
  .float-menu.visible { display: flex; opacity: 1; }
  .float-menu div { width: 18px; height: 2px; background: #fff; border-radius: 2px; }
  .float-menu:hover { transform: scale(1.08); }
}

@media (max-width: 1000px) { 
  header { 
    width: 100%; 
    border-radius: 0; 
    margin-top: 0; 
    margin-left:0; 
    padding: 0 15px; 
    justify-content: space-between;
  }
  
  .nav-tabs, #clockDisplay { display: none; }
  .hamburger { display: flex; }
  
  .layout { 
    flex-direction:column; 
    padding: 20px 15px;
  } 
  
  .sidebar { width:100%; } 
  .sticky-widget { position:static; } 
  
  .card-hero { 
    flex-direction:column; 
    height:auto; 
    grid-column: auto;
  } 
  
  .card-hero .card-img { 
    width:100%; 
    height:220px; 
    border-radius: 16px 16px 0 0;
  } 
  
  .card-hero .card-body { width: 100%; }
  
  #output { 
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
  }
}

@media (max-width: 600px) {
  .layout { padding: 15px 12px; }
  #output { grid-template-columns: 1fr; gap: 15px; }
  .brand { margin-right: 15px; }
  .logo-text { font-size: 20px; letter-spacing: -1px; }
  .section-label { font-size: 17px; }
}
