/* =========================================
   1. BROWSE HEADER
   ========================================= */
   .browse-header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 20px;
    background: #f8f9fa;
}

.browse-header h1 {
    font-size: 32px;
    font-weight: 900;
    color: #111827;
    margin: 0 0 10px 0;
}


/* =========================================
   2. HORIZONTAL FILTER BAR
   ========================================= */
.filter-bar {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    margin-bottom: 40px;
}

.horizontal-form {
    display: flex;
    gap: 15px;
    align-items: flex-end; /* Aligns inputs with button */
    flex-wrap: wrap;
    justify-content: center;
}

.h-form-group {
    flex: 1;
    min-width: 160px; /* Ensures inputs don't get too squashed */
}

/* Smaller width for Year/Month to save space */
.h-form-group.small {
    flex: 0 0 110px;
}

.h-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: #374151;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.h-form-group select,
.h-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    color: #111827;
    transition: border-color 0.2s;
}

.h-form-group select:focus,
.h-form-group input:focus {
    border-color: #0056b3;
    outline: none;
}

/* Filter Button */
.h-btn-filter {
    background: #0056b3;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    height: 42px; /* Matches input height */
    font-size: 14px;
    transition: background 0.2s, transform 0.1s;
    min-width: 120px;
}

.h-btn-filter:hover {
    background: #004494;
    transform: translateY(-1px);
}

/* =========================================
   3. UNIVERSAL GRID (4 Columns)
   ========================================= */
.universal-grid {
    display: grid;
    /* 4 Equal Columns */
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Card Container */
.uni-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensures all cards in a row are same height */
    position: relative;
    cursor: pointer;
}

.uni-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: #d1d5db;
}

/* Card Header (Category & Views) */
.uni-card-top {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    background: #ffffff;
}

.uni-category {
    font-size: 10px;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.uni-views {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 600;
}

/* Card Body */
.uni-card-body {
    padding: 15px;
    flex-grow: 1; /* Pushes footer to bottom */
}

.uni-title {
    font-size: 16px;
    margin: 0 0 6px 0;
    color: #111827;
    line-height: 1.3;
    font-weight: 700;
}

.uni-subtitle {
    display: block;
    font-size: 12px;
    color: #0056b3;
    margin-bottom: 10px;
    font-weight: 600;
}

.uni-excerpt {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.5;
    margin: 0;
    /* Truncate text after 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Footer */
.uni-card-footer {
    padding: 10px 15px;
    border-top: 1px solid #f3f4f6;
    background: #f9fafb;
}

.uni-link {
    font-size: 11px;
    color: #0056b3;
    font-weight: 800;
    text-transform: uppercase;
}

/* =========================================
   4. PAGINATION
   ========================================= */
.pagination {
    margin-top: 50px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.page-link {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.page-link:hover {
    background: #f3f4f6;
    color: #111827;
}

.page-link.active {
    background: #0056b3;
    color: white;
    border-color: #0056b3;
}

.page-link.prev, .page-link.next {
    font-weight: 800;
}

/* =========================================
   5. RESPONSIVE DESIGN
   ========================================= */

/* Tablet: Switch to 2 Columns, Stack Filter inputs slightly */
/* =========================================
   5. RESPONSIVE DESIGN (UPDATED)
   ========================================= */

/* Tablet: Switch to 2 Columns */
/* =========================================
   MOBILE DESIGN: COMPACT CARDS + 2 LINES
   ========================================= */

   @media (max-width: 768px) {
    /* --- 1. COMPACT FILTER CONTAINER --- */
    .filter-bar {
        padding: 15px; /* Reduce outer padding */
    }
    
/* Change Form to a 2-Column Grid instead of a vertical stack */
    .horizontal-form {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two items side-by-side */
    gap: 10px; /* Tighter spacing */
    }

    .h-form-group.btn-group {
    grid-column: span 2; 
    margin-top: 5px;
    }

    .h-form-group, .h-form-group.small {
        width: auto;
        min-width: 0;
    }
    .h-btn-filter {
        width: 100%;
        padding: 8px; /* Slightly thinner button */
        height: 38px;
    }

    .h-form-group label { font-size: 11px; margin-bottom: 3px; }
    .h-form-group select { padding: 8px; height: 38px; font-size: 13px; }


    /* --- INTELLIGENT COMPACT CARD --- */
    /* --- 2. COMPACT POST GRID (From previous step) --- */
    .universal-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .uni-card { height: auto; }
    .uni-card-top { padding: 6px 12px; }
    .uni-category { font-size: 9px; }
    .uni-views { font-size: 10px; }
    .uni-card-body { padding: 8px 12px 12px 12px; }
    .uni-title { font-size: 15px; margin-bottom: 2px; line-height: 1.3; }
    
    /* Limit Subtitle to 1 line */
    .uni-subtitle {
        font-size: 11px; margin-bottom: 4px; 
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }

    /* Show exactly 2 lines of text */
    .uni-excerpt {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 12px; line-height: 1.4; color: #555; margin-top: 4px;
    }

    /* Hide Footer */
    .uni-card-footer { display: none; }
}