/*
 * File: /css/searchResults.css
 * Reusable recipe/cookbook search-result presentation.
 * Safe to load on recipes.php, searchRecipes.php, or other pages.
 * Contains no body, :root, site shell, header, nav, or account-button styling.
 */

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

.searchResultsSection {
    margin-top: 17px;
}


.resultsToolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
}

.resultsSummary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
}

.resultsSummary h1 {
    margin: 0;
    font-size: 21px;
}

#resultsCount,
#recipeResultCount,
#cookbookResultCount {
    color: var(--muted);
    font-size: 12px;
}

.resultsViewOptions {
    display: flex;
    gap: 3px;
    padding: 3px;
    background: #e9ecf0;
    border-radius: 8px;
}

.resultsViewOptions button {
    border: 0;
    background: transparent;
    border-radius: 6px;
    padding: 7px 13px;
    color: #59616c;
}

.resultsViewOptions button.active {
    background: #fff;
    color: var(--text);
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

#searchStatus {
    color: var(--muted);
    font-size: 13px;
}

#searchStatus:not(:empty) {
    padding: 12px 0;
}

/* RESULT SECTIONS */

#recipeResultsSection,
#cookbookResultsSection {
    margin-bottom: 22px;
}

.resultSectionHeading {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 11px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.resultSectionHeading h2 {
    margin: 0;
    font-size: 17px;
}

/* RESULT CARDS */

.resultCard {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    min-width: 0;
    transition: border-color .15s, box-shadow .15s;
}

.resultCard:hover {
    border-color: #c8cdd5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .06);
}

.resultCard a {
    color: inherit;
    text-decoration: none;
}

.resultImage {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: #eceef1;
}

.resultImagePlaceholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #f0f1f3;
    font-size: 44px;
}

.resultContent {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: 13px;
}

.resultTitle {
    margin: 0 0 7px;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 700;
}

.resultDescription {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.resultMeta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 12px;
    margin-top: auto;
    color: var(--muted);
    font-size: 11px;
}

.resultTag {
    display: inline-flex;
    align-items: center;
    padding: 4px 7px;
    background: #f0f1f3;
    border-radius: 5px;
    font-size: 11px;
}

/* GRID VIEW */

.resultsContainer.view-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.resultsContainer.view-grid .resultCard {
    display: flex;
    flex-direction: column;
}

/* ROW VIEW */

.resultsContainer.view-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.resultsContainer.view-rows .resultCard {
    display: flex;
    flex-direction: row;
    min-height: 135px;
}

.resultsContainer.view-rows .resultImage,
.resultsContainer.view-rows .resultImagePlaceholder {
    width: 190px;
    min-width: 190px;
    height: auto;
    aspect-ratio: auto;
    object-fit: cover;
}

.resultsContainer.view-rows .resultContent {
    padding: 15px;
}

.resultsContainer.view-rows .resultDescription {
    margin-bottom: 8px;
}

/* TEXT VIEW */

.resultsContainer.view-text {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.resultsContainer.view-text .resultCard {
    display: block;
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
}

.resultsContainer.view-text .resultCard:last-child {
    border-bottom: 0;
}

.resultsContainer.view-text .resultCard:hover {
    background: #f8f9fa;
}

.resultsContainer.view-text .resultImage,
.resultsContainer.view-text .resultImagePlaceholder {
    display: none;
}

.resultsContainer.view-text .resultContent {
    padding: 11px 14px;
}

.resultsContainer.view-text .resultTitle {
    margin-bottom: 4px;
    font-size: 14px;
}

.resultsContainer.view-text .resultDescription {
    margin-bottom: 5px;
    font-size: 12px;
}

.resultsContainer.view-text .resultMeta {
    margin-top: 3px;
}

/* PAGINATION */

.resultsPagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 22px;
}

.resultsPagination button {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 15px;
    font-weight: 600;
}

.resultsPagination button:not(:disabled):hover {
    border-color: var(--accent);
    color: var(--accent);
}

#resultsPageNumber {
    font-size: 12px;
    color: var(--muted);


/* Responsive result layouts */

@media (max-width: 1100px) {
    .resultsContainer.view-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .resultsContainer.view-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 550px) {
    .resultsSummary h1 {
        font-size: 18px;
    }

    .resultsViewOptions button {
        padding: 7px 10px;
        font-size: 12px;
    }

    .resultsContainer.view-grid {
        gap: 10px;
    }

    .resultContent {
        padding: 10px;
    }

    .resultTitle {
        font-size: 14px;
    }

    .resultDescription {
        font-size: 12px;
    }

    .resultsContainer.view-rows .resultImage,
    .resultsContainer.view-rows .resultImagePlaceholder {
        width: 105px;
        min-width: 105px;
    }

    .resultsContainer.view-rows .resultContent {
        padding: 10px;
    }

    .resultsContainer.view-rows .resultTitle {
        font-size: 14px;
    }

    .resultsContainer.view-rows .resultDescription {
        font-size: 12px;
    }

    .resultCard {
        border-radius: 12px;
    }
}

/* Warm result-card theme */

.resultCard {
    background: #fffdf8;
    border: 1px solid rgba(48, 42, 32, .14);
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(50, 40, 30, .07);
}

.resultCard:hover {
    border-color: rgba(201, 47, 47, .32);
    box-shadow: 0 9px 25px rgba(55, 43, 28, .13);
}

.resultTitle {
    color: #292722;
    font-weight: 800;
}

.resultCard a:hover .resultTitle {
    color: #b52929;
}

.resultDescription,
.resultMeta {
    color: #716d64;
}

.resultTag {
    background: #eee1cf;
    color: #59432f;
    border-radius: 999px;
    font-weight: 700;
}

.resultCard button {
    border: 1px solid rgba(48, 42, 32, .18);
    border-radius: 7px;
    background: #fffaf1;
    color: #554335;
    cursor: pointer;
}

.resultCard button:hover {
    background: #f2e4d1;
    border-color: #c92f2f;
    color: #982323;
}
