/* ======================================================================
   Results Page Styles
   ======================================================================= */

/* ================================================
    Results Container
   ================================================ */

/* Layout for results and sidebar sections */
.results-section {
    width: 100%;
    margin-bottom: 30px;
}

.results-container {
    margin: 10px 0;
}

.sidebar-section {
    width: 100%;
    margin-top: 30px;
    margin-bottom: 30px;
}

.search-results-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.main-results {
    flex: 1;
    max-width: 75%;
}

.header h2 {
    font-size: 32px;
}


/* ================================================
    Back Button
   ================================================ */

/* Back button styling */
.back-button {
    background-color: var(--color-brand-orange);
    color: white;
    padding: 10px 15px 10px 5px;
    border-radius: 25px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

.back-button i {
    margin-right: 8px;
}

.back-button:hover {
    background-color: var(--color-brand-blue);
    color: white;
    text-decoration: none;
}

/* ================================================
    Article Cards
   ================================================ */

.article-card {
    background-color: var(--color-background);
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.11);
    transition: transform 0.2s;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.article-title {
    color: var(--color-brand-green); 
    /* color: var(--color-dark-gray); */
    font-size: 22px;
    margin-bottom: 0.5em;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.article-date {
    color: var(--color-dark-gray);
    font-size: 18px;
}

.article-link {
    color: var(--color-brand-orange);
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 18px;
}

.article-link:hover {
    color: var(--color-brand-blue);
}

.article-snippet {
    color: var(--color-dark-gray);
    font-size: 17px;
    line-height: 1.5;
}

.article-snippet mark {
    background-color: var(--color-background);
    padding: 0.1em 0.2em;
    border-radius: 0.2em;
}

.alert-info {
    background-color: var(--color-background) !important;
    margin: 20px 0 !important;
    color: var(--color-dark-gray);
    border: 1px;
    border-color: var(--color-light-gray);
}

/* ================================================
    Right Sidebar
   ================================================ */

.sidebar {
    /* position: sticky;                               Pin filters to the top of the page */
    position: static;
    background-color: var(--color-background);
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.11);
    margin: 37px 0 20px 0;
    border-top: 1px solid var(--color-light-gray);
}

/* Container for search results */
.row {
    display: flex;
    align-items: flex-start;
}

.sidebar h3 {
    color: var(--color-dark-gray);
    font-size: 22px;
    margin-bottom: 1rem;
    font-weight: bolder;
}

.sidebar .filter-section {
    margin-bottom: 1.5rem;
}

.date-filter {
    margin-bottom: 1rem;
}

.date-filter label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-dark-gray);
}

.date-filter input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-background);
    border-radius: 4px;
}

.year-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    color: var(--color-dark-gray);
    text-decoration: none;
    border-bottom: 1px solid var(--color-light-gray);
}

.year-filter:hover {
    color: var(--color-brand-blue);
}

.year-filter .badge {
    background-color: var(--color-brand-green) ;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* ================================================
    Search Form
   ================================================ */

.search-form {
    margin-bottom: 2rem;
}

/* ================================================
    Search Parameters
   ================================================ */

.search-parameters {
    margin-bottom: 1rem;
}

.search-parameters div {
    background-color: var(--color-background);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.search-parameters strong {
    color: var(--color-brand-blue);
}

.article-snippet mark {
    background-color: var(--color-brand-orange);
    color: white;
    padding: 0.1em 0.2em;
    border-radius: 0.2em;
}

/* ================================================
    Buttons
   ================================================ */

.btn-orange {
    background-color: var(--color-brand-orange);
    border-color: var(--color-brand-orange);
    color: white;
}

.btn-orange:hover {
    background-color: var(--color-brand-orange);
    border-color: var(--color-brand-orange);
    color: white;
}

.btn-orange:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 165, 0, 0.25);
    color: white;
}


/* ================================================
   Pagination
   ================================================ */

/* Pagination styling */
.pagination-container {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
    overflow-x: hidden;
}

/* Pagination styles 
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 20px 0;
}
*/

.pagination .page-item {
    margin: 0;
}

.pagination .page-link {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    color: var(--color-dark-gray);
    border: 1px solid var(--color-light-gray);
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.pagination .page-item.active .page-link {
    background-color: var(--color-brand-orange);
    /* border-color: var(--color-brand-orange); */
    color: white;
}

.pagination .page-link:hover:not(.disabled) {
    background-color: var(--color-brand-orange-light);
    color: var(--color-brand-blue);
    border-color: var(--color-brand-orange);
}

/* Override Bootstrap */

nav[aria-label="Page navigation"] {
    width: 100%;              /* nav can never grow wider than its column   */
    overflow-x: auto;         /* graceful fallback on really small screens  */
}

nav[aria-label="Page navigation"] .pagination {
    display: flex;
    flex-flow: row wrap !important;  /* row + wrap overrides Bootstrap       */
    justify-content: center;
    gap: 5px;
    max-width: 100%;                 /* keeps the <ul> inside the <nav>      */
}

/* ================================================
   Responsive
   ================================================ */

/* For screens larger than 1024px */
@media only screen and (min-width: 1024px) {
    .content {
        display: flex;
        justify-content: space-between;
        gap: 30px;
    }
    
    .results-section {
        width: 70%; /* Adjust width as needed */
        order: 1; /* Display results first (left side) */
    }
    
    .sidebar-section {
        width: 30%; /* Adjust width as needed */
        order: 2; /* Display sidebar second (right side) */
        margin-top: 0; /* Remove top margin when side by side */
    }
    
    .sidebar {
        position: sticky;
        top: 20px; /* Adjust as needed */
    }
}

@media only screen and (max-width: 1023px) {

    .sidebar-section {
        width: 100% !important;
        float: none !important;
        display: block !important;
        margin-top: 40px !important;
        clear: both !important; /* Ensure it clears any floats */
        border-top: 1px solid #DEDEDE;
        padding-top: 20px;
    }

}


/* ===============================
    Small Devices (<800px)
   ============================== */

@media only screen and (max-width: 800px) {

    /* APP SPECIFIC */

    .content {
        display: block !important; /* Use block instead of flex */
        width: 100% !important;
    }
    
    .results-section {
        width: 100% !important;
        float: none !important;
        display: block !important;
    }

    /* Add a visual separator when sidebar is below */
    .sidebar {
        margin-top: 0 !important;
        box-shadow: none !important;


        border-top: 1px solid var(--color-light-gray);
        padding-top: 20px;
        margin-top: 10px;
    }
    
    /* Mobile-friendly year filters */
    .year-filters {
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;             /* Spread items across the container */
        width: 100%;
        gap: 10px !important;
    }
    
    .year-filter {
        display: flex;
        justify-content: space-between;     /* Year on left, badge on right */
        align-items: center;
        flex: 1;                            /* Grow to fill available space */
        min-width: 45%;                     /* Each takes roughly half the width minus gap */
        padding: 12px 15px;
        width: 100%;
        padding: 12px 15px !important;
        margin: 5px !important;
        background-color: var(--color-background)!important;
        border-radius: 6px !important;
        text-align: center;
        border: 1px solid var(--color-light-gray) !important;
        text-decoration: none !important;
        transition: all 0.2s ease;
    }

    .year-filter:hover {
        background-color: var(--color-brand-orange-light);
        color: white;
        border-color: var(--color-brand-orange);
    }
    
    .year-filter:hover, .year-filter:focus {
        background-color: var(--color-brand-orange-light);
        color: var(--color-brand-blue);
        border-color: var(--color-brand-orange);
        text-decoration: none;
    }
    
    .year-filter .badge {
        font-weight: bold;
        margin-left: 5px;
        float: right;
    }

    .pagination .page-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
}