/* ClearCutCoverage V3 - Header & Navigation Styles */

/* ============================================
   HEADER / TOPBAR
   ============================================ */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1.5rem;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

/* ============================================
   NAVIGATION
   ============================================ */
.navlinks {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.navlinks a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.navlinks a:hover,
.navlinks a.active {
    color: #fff;
}

/* ============================================
   DARK/LIGHT TOGGLE - COMPACT PILL BUTTON
   ============================================ */
#theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 30px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    margin-left: 0.5rem;
}

#theme-toggle:hover {
    background: #333;
    border-color: #555;
}

/* ============================================
   FILTER TABS (index page)
   ============================================ */
.tabs {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0 18px;
    margin: 10px auto 0;
    max-width: 1100px;
}

.tab {
    background: transparent;
    border: 1px solid #444;
    color: #ccc;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
}

.tab.active {
    color: #fff;
    border-color: #555;
    background: #2a2a2a;
}

/* ============================================
   LIGHT THEME OVERRIDES
   ============================================ */
body.theme-light .topbar {
    background: #f5f5f5;
    border-bottom-color: #ddd;
}

body.theme-light .brand {
    color: #1a1a1a;
}

body.theme-light .navlinks a {
    color: #555;
}

body.theme-light .navlinks a:hover,
body.theme-light .navlinks a.active {
    color: #1a1a1a;
}

body.theme-light #theme-toggle {
    background: #e5e5e5;
    border-color: #ccc;
}

body.theme-light #theme-toggle:hover {
    background: #ddd;
}

body.theme-light .tab {
    color: #555;
    border-color: #ccc;
}

body.theme-light .tab.active {
    background: #ececf1;
    border-color: #d0d0d7;
    color: #1a1a1a;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        padding: 0.5rem 1rem;
    }

    .brand {
        font-size: 1.1rem;
    }

    .navlinks {
        gap: 1rem;
        width: 100%;
        margin-left: 0;
        order: 2;
        justify-content: flex-start;
    }

    .navlinks a {
        font-size: 0.8rem;
    }

    #theme-toggle {
        width: 40px;
        height: 28px;
        order: 3;
        margin-left: auto;
    }

    .tabs {
        flex-wrap: wrap;
        padding: 0 12px;
    }
}

/* ============================================
   FOOTER (if kept)
   ============================================ */
.site-footer {
    padding: 1.5rem;
    background: #1a1a1a;
    border-top: 1px solid #333;
    text-align: center;
    margin-top: auto;
}

.site-footer p {
    color: #666;
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-nav a {
    color: #888;
    text-decoration: none;
    font-size: 0.8rem;
}

.footer-nav a:hover {
    color: #ccc;
}

/* ============================================
   NEWS CARD STYLES
   ============================================ */
.headline-card {
  background: #1e1e1e;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.corner-badge {
  position: absolute;
  top: 0;
  right: 0;
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 0 12px 0 8px;
}

.corner-badge.conservative { background: #dc2626; color: white; }
.corner-badge.liberal { background: #2563eb; color: white; }
.corner-badge.neutral { background: #ca8a04; color: white; }

.headline-card > a:first-of-type {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  display: block;
  margin-bottom: 8px;
  padding-right: 80px;
}

.headline-card > a:first-of-type:hover {
  text-decoration: underline;
}

.meta {
  color: #9ca3af;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.visit-link {
  color: #60a5fa;
  font-size: 0.9rem;
  text-decoration: none;
}

.visit-link:hover {
  text-decoration: underline;
}

/* Card grid for desktop */
#headlines {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 0 16px;
}

@media (max-width: 768px) {
  #headlines {
    grid-template-columns: 1fr;
    padding: 0 12px;
  }
}
/* ============================================
   THREE COLUMN LAYOUT
   ============================================ */

#headlines {
  display: flex;
  gap: 20px;
  padding: 0 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.column {
  flex: 1;
  min-width: 0;
}

.column-header {
  text-align: center;
  padding: 12px;
  margin: 0 0 16px 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}

.column-header.liberal {
  background: #2563eb;
  color: white;
}

.column-header.neutral {
  background: #ca8a04;
  color: white;
}

.column-header.conservative {
  background: #dc2626;
  color: white;
}

/* Single column for filtered view or mobile */
.single-column {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

.single-column.filtered {
  max-width: 900px;
}

/* Mobile: Stack to single column with interleaved content */
@media (max-width: 768px) {
  #headlines {
    flex-direction: column;
    padding: 0 12px;
  }
  
  .column {
    display: none;
  }
  
  .single-column {
    display: block;
  }
}

/* Ensure cards in columns don't use grid */
.column .headline-card,
.single-column .headline-card {
  margin-bottom: 16px;
}

/* Remove the grid from #headlines since we're using flexbox columns now */
#headlines {
  display: flex !important;
  grid-template-columns: unset !important;
}

/* ============================================
   CARD IMAGES
   ============================================ */
.card-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
  margin: -20px -20px 12px -20px;
  width: calc(100% + 40px);
}

.headline-card.has-image {
  padding-top: 0;
}


.card-content {
  /* Wrapper for text content */
}

/* Adjust for cards without images */
.headline-card:not(.has-image) .card-content {
  padding-top: 0;
}

/* Fix badge z-index for cards with images */
.corner-badge {
  z-index: 10;
}

.headline-card.has-image .corner-badge {
  top: 10px;
  right: 10px;
  border-radius: 4px;
}

/* ============================================
   MOBILE FIXES
   ============================================ */

/* Ensure headline text doesn't overlap badge */
.headline-card > a:first-of-type,
.card-content > a:first-of-type {
  padding-right: 100px;
  display: block;
}

/* Mobile: show images */
@media (max-width: 768px) {
  .card-image {
    display: block !important;
  }
  
  /* Ensure badge stays visible */
  .corner-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
  }
}

/* Fix theme toggle position on mobile */
@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
  }
  
  #theme-toggle {
    position: absolute;
    top: 14px;
    right: 16px;
  }
  
  .navlinks {
    width: 100%;
    margin-top: 8px;
    padding-right: 50px;
  }
}

/* Collapse image space when image hidden */
.headline-card:not(.has-image) .card-image {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
}

/* Fallback: if image fails, don't reserve space */
.card-image[style*="display: none"],
.card-image[style*="display:none"] {
  height: 0 !important;
  margin: 0 !important;
}

/* Auto-refresh banner */
#refresh-banner button {
  background: white;
  color: #2563eb;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

#refresh-banner button:hover {
  background: #f0f0f0;
}

#refresh-banner button:last-child {
  background: transparent;
  color: white;
  border: 1px solid white;
}

#refresh-banner button:last-child:hover {
  background: rgba(255,255,255,0.1);
}
