/* --- SBIR Search Tool Styles --- */
/* Version: 1.1.0 */

.sbir-search-tool-container .container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.sbir-search-tool-container .search-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.sbir-search-tool-container .search-controls input,
.sbir-search-tool-container .search-controls select,
.sbir-search-tool-container .search-controls button {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.sbir-search-tool-container .search-controls input {
    flex: 1;
    min-width: 200px;
}

.sbir-search-tool-container .search-controls select {
    min-width: 150px;
}

.sbir-search-tool-container .search-controls button {
    background-color: #007cba;
    color: white;
    border: none;
    cursor: pointer;
    min-width: 100px;
    transition: background-color 0.2s ease-in-out;
}

.sbir-search-tool-container .search-controls button:hover {
    background-color: #005a87;
}

.sbir-search-tool-container .loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.sbir-search-tool-container .error {
    color: #d32f2f;
    padding: 10px 15px;
    background-color: #ffebee;
    border-radius: 4px;
    margin: 10px 0;
}

.sbir-search-tool-container .results {
    margin-top: 20px;
}

.sbir-search-tool-container .stats {
    margin-bottom: 20px;
    padding: 10px 15px;
    background-color: #e3f2fd;
    border: 1px solid #bde0fe;
    border-radius: 4px;
    font-size: 14px;
}

.sbir-search-tool-container .no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* --- TOPIC CARD STYLES (REVISED & IMPROVED) --- */

.topic-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Creates consistent spacing between sections */
}

/* NEW: Styles for the header containing the title and link */
.topic-header {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    justify-content: space-between;
    align-items: flex-start; /* Align items to the top */
    gap: 15px; /* Space between title and button */
}

.topic-title {
    font-size: 20px;
    font-weight: 600;
    color: #007cba;
    margin: 0; /* Remove default margins */
    flex-grow: 1; /* Allow title to take available space */
}

/* REVISED: Styles for the "View Full Topic" link */
.topic-link {
    display: inline-block;
    background-color: #007cba;
    color: white !important; /* Ensure color overrides theme styles */
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap; /* Prevent button from wrapping text */
    flex-shrink: 0; /* Prevent button from shrinking */
    transition: background-color 0.2s ease-in-out;
    max-width: 110px;
    width: fit-content;
}

.topic-link:hover {
    background-color: #005a87;
}

/* REVISED: Combine rules for both meta and dates grids for a unified look */
.topic-meta,
.topic-dates {
    display: grid;
    /* This creates responsive columns that are at least 220px wide */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 20px; /* 8px row-gap, 20px column-gap */
    font-size: 14px;
    color: #333;
}

.topic-meta > div,
.topic-dates > div {
    line-height: 1.4;
}

.topic-description {
    line-height: 1.6; /* Increased line-height for readability */
    color: #555;
    margin: 0;
}

.topic-description p {
    margin: 0; /* Remove default paragraph margin */
}

/* --- PAGINATION STYLES --- */

#pagination-container {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.pagination-nav {
    text-align: center;
}

/* The rest of the pagination styles can remain the same */
.pagination-nav ul {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.pagination-nav li {
    margin: 0;
}

.pagination-nav .page-info {
    display: block;
    padding: 0 15px;
    line-height: 38px;
    background: #f7f7f7;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    font-size: 14px;
    color: #333;
}

.pagination-nav button {
    background-color: white;
    color: #007cba;
    border: none;
    padding: 0 15px;
    cursor: pointer;
    font-size: 14px;
    height: 40px;
    transition: background-color 0.2s;
}

.pagination-nav button:hover:not([disabled]) {
    background-color: #e3f2fd;
}

.pagination-nav button:disabled {
    color: #aaa;
    cursor: not-allowed;
}