/* The "Gold Standard" Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

/* General Styles */
body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
   font-weight: 400;
 line-height: 1.5em;
    background: #f7f7f7;
    color: #222;
}

input, button, textarea, select {
        font-family: 'Inter', Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', Arial, sans-serif;
}

main {
    max-width: 900px;
    margin: 40px auto;
    padding: 30px;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.navbar {
    background: #111;
    color: white;
    padding: 0 30px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 400;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 25px; /* Spacing between links */
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.8;
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #F8FAFC;
}

.logo-icon {
    width: 28px;
    height: 28px;
    transform: rotate(-15deg);
}

/* Hero Section */
.hero {
    max-width: 1200px;
    margin: 40px auto;
    padding: 60px 20px;
    text-align: center;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
}

.hero-title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.4em;
    margin-bottom: 20px;
    color: #111;
}

.hero-subtitle {
    font-size: 18px;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Filters Section */
.filters {
    max-width: 1200px;
    margin: 20px auto 40px;
    padding: 0 20px;
}

.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

#searchInput, #categorySelect, #sortSelect {
    padding: 10px 14px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ccc;
    min-width: 180px;
    transition: all 0.2s ease;
}

#searchInput:focus, #categorySelect:focus, #sortSelect:focus {
    outline: none;
    border-color: #90caf9;
    box-shadow: 0 0 4px rgba(30,136,229,0.4);
}

#searchBtn {
    padding: 12px 20px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    background-color: #1e88e5;
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

#searchBtn:hover {
    background-color: #1565c0;
}

/* Podcast Grid */
.podcast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 0 20px;
    align-items: start;
}

#podcastGrid {
    opacity: 0;
    transition: opacity 0.2s ease;
}

#podcastGrid.ready {
    opacity: 1;
}

/* Podcast Card */
.podcast-card {
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    overflow: hidden;
    padding: 16px 16px 2px 16px;
    box-sizing: border-box;
    transition: all 0.3s;
}

.podcast-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
}

/* Card Content */
.podcast-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
    padding: 8px 0;
}

.podcast-info h3 {
    margin: 0 0 4px;
    font-size: 18px;
    cursor: pointer;
    color: #1e88e5;
}

.podcast-info h3:hover {
    text-decoration: underline;
}

.host {
    margin: 0 0 6px;
    font-size: 13px;
    color: #555;
}

/* Categories */
.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.category-tag {
    background: #eef3ff;
    color: #1e4db7;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Description */
.description-wrapper {
    flex-grow: 1;
    min-height: 0;
    overflow: hidden;
}

.description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.description.expanded {
    -webkit-line-clamp: unset;
}

/* Read More */
.read-more {
    background: none;
    border: none;
    color: #1e88e5;
    cursor: pointer;
    font-weight: 600;
    padding: 0;
    margin: 6px 0 10px;
    text-align: left;
}

/* Footer */
.card-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

/* Listener Score Badge */
.listener-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #444;
}

.listener-score .score-label {
    color: #888;
    letter-spacing: 0.3px;
    font-size: 13px;
}

/* Ensure the card you hover over sits on TOP of its neighbors */
.podcast-card:hover {
    z-index: 100;
}

/* 2. Style the specific number badge as the anchor */
.tooltip-container {
    position: relative;
    display: inline-block;
}

/* 3. The Tooltip Box (Positioned to the LEFT) */
.tooltip-container::after {
    content: attr(data-tooltip);
    position: absolute;
    
    /* Center vertically relative to the badge */
    top: 50%;
    /* Push to the left */
    right: 125%; 
    transform: translateY(-50%);
    
    /* Styling */
    width: 220px;
    padding: 10px;
    background-color: #111;
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 8px;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    
    /* Visibility logic */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, right 0.2s ease;
    z-index: 9999;
    pointer-events: none;
    white-space: normal; /* Ensures text wraps inside the 220px width */
}

/* 4. The Arrow pointing to the number */
.tooltip-container::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 110%;
    transform: translateY(-50%);
    border-width: 6px;
    border-style: solid;
    /* Arrow points right, so color is on the left border */
    border-color: transparent transparent transparent #111;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, right 0.2s ease;
    z-index: 9999;
}

/* 5. Show on Hover */
.tooltip-container:hover::after {
    visibility: visible;
    opacity: 1;
    right: 135%; /* Subtle slide-in effect */
}

.tooltip-container:hover::before {
    visibility: visible;
    opacity: 1;
    right: 120%;
}

.results-count {
    max-width: 1200px;
    margin: 0 auto 20px;
    padding: 0 20px;
    font-size: 18px;
    font-weight: 600;
    color: #555;
    text-align: left; /* Change to center if you prefer */
}

/* Footer Styles */
/* Footer References Styling */
.site-footer {
    background: #111;
    color: white;
    padding: 40px 20px;
    margin-top: 60px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column; /* Stacked for a cleaner look */
    align-items: center;
    gap: 20px;
}

.footer-references {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.reference-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888; /* Dimmer color for the label */
    font-weight: 700;
}

.reference-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.reference-links a {
    color: #1e88e5; /* Using your theme's blue */
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.reference-links a:hover {
    color: white;
    text-decoration: underline;
}

.footer-info p {
    font-size: 14px;
    opacity: 0.6;
}

.site-footer p {
    margin: 0;
    font-size: 14px;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 600px) {
    .filters-container { flex-direction: column; align-items: stretch; }
    .filter-group { width: 100%; }

    #searchInput, #categorySelect, #sortSelect, #searchBtn { width: 100%; }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }
    /* 1. Remove the 30px side padding that's causing the gap */
    .navbar {
        padding: 0; 
    }

    .nav-container {
        flex-direction: column;
        height: auto;
        width: 100%;
        max-width: none; /* Ensure it doesn't throttle on larger tablets */
        margin: 0;
    }

    .logo {
        padding: 20px 0;
        justify-content: center; /* Center logo now that space is full width */
        width: 100%;
    }

    /* 2. Setup the links container with a top line */
    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0; 
        border-top: 1px solid rgba(255, 255, 255, 0.2); 
    }

    /* 3. Make each link a full-width block with a bottom line */
    .nav-links a {
        display: block;      /* Important: makes the <a> fill the row */
        width: 100%;         
        padding: 18px 0;     /* Increased padding for easier tapping */
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        box-sizing: border-box; /* Ensures padding doesn't push width > 100% */
    }

    /* 4. Fix the bottom "cut off" appearance */
    .nav-links a:last-child {
        border-bottom: none; /* Optional: remove last line if it looks too heavy */
    }
}
