/**
 * WP Cache Buster - Search Results Styles
 */

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

.wpcb-search-form {
    margin-bottom: 30px;
}

.wpcb-search-input-wrapper {
    display: flex;
    gap: 10px;
    max-width: 600px;
}

.wpcb-search-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wpcb-search-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.wpcb-search-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wpcb-search-button:hover {
    background: #005a87;
}

.wpcb-search-icon {
    width: 18px;
    height: 18px;
}

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

.wpcb-search-results {
    margin: 0 auto;
}

.wpcb-search-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.wpcb-search-meta {
    font-size: 18px;
    color: #555;
    margin: 0;
}

.wpcb-search-meta strong {
    color: #333;
}

/* ==========================================================================
   No Results
   ========================================================================== */

.wpcb-no-results {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.wpcb-no-results p:first-child {
    font-size: 20px;
    color: #666;
    margin-bottom: 20px;
}

.wpcb-search-suggestions {
    font-weight: 600;
    margin-bottom: 10px !important;
}

.wpcb-no-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wpcb-no-results li {
    color: #888;
    padding: 5px 0;
}

.wpcb-no-results li:before {
    content: "→ ";
    color: #0073aa;
}

.wpcb-no-query {
    text-align: center;
    padding: 40px;
    background: #f0f6fc;
    border-radius: 8px;
    color: #555;
    font-size: 18px;
}

/* ==========================================================================
   Results List
   ========================================================================== */

.wpcb-results-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.wpcb-search-result {
    position: relative;
}

/* Highlight */
.wpcb-highlight,
mark.wpcb-highlight {
    background: #fff3cd;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* Post type badge */
.wpcb-post-type-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    background: #f0f0f0;
    color: #666;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* Excerpt */
.wpcb-result-excerpt {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
}

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

.wpcb-pagination {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.wpcb-pagination-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

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

.wpcb-page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 8px 14px;
    font-size: 15px;
    color: #333;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

a.wpcb-page-link:hover {
    background: #f5f5f5;
    border-color: #ccc;
    color: #0073aa;
}

.wpcb-page-item.active .wpcb-page-link {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
    font-weight: 600;
}

.wpcb-page-item.disabled .wpcb-page-link {
    color: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

.wpcb-page-item.wpcb-ellipsis .wpcb-page-link {
    border: none;
    background: transparent;
    min-width: auto;
    padding: 8px;
}

.wpcb-pagination-info {
    font-size: 14px;
    color: #888;
}

.wpcb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Loading State (AJAX)
   ========================================================================== */

/* Initial loading state (page load) */
.wpcb-search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 200px;
}

.wpcb-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: wpcb-spin 0.8s linear infinite;
    margin-bottom: 20px;
}

.wpcb-search-loading p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* Error state */
.wpcb-search-error {
    text-align: center;
    padding: 40px;
    background: #fff0f0;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
}

.wpcb-search-error p {
    color: #c62828;
    margin: 0;
}

/* Overlay loading state (pagination) */
.wpcb-search-results.wpcb-loading {
    position: relative;
    min-height: 200px;
}

.wpcb-search-results.wpcb-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.wpcb-search-results.wpcb-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    z-index: 11;
    animation: wpcb-spin 0.8s linear infinite;
}

@keyframes wpcb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Template: Compact
   ========================================================================== */

.wpcb-template-compact .wpcb-search-result {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.wpcb-template-compact .wpcb-search-result:last-child {
    border-bottom: none;
}

.wpcb-template-compact .wdt_img {
    display: none;
}

.wpcb-template-compact h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.wpcb-template-compact .wpcb-result-excerpt {
    font-size: 14px;
    margin-bottom: 8px;
}

.wpcb-template-compact .more-link {
    font-size: 14px;
}

/* ==========================================================================
   Template: Card
   ========================================================================== */

.wpcb-template-card .wpcb-results-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.wpcb-template-card .wpcb-search-result {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 0 !important;
    padding: 0 !important;
}

.wpcb-template-card .wpcb-search-result:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.wpcb-template-card .wdt_img {
    margin-bottom: 0;
}

.wpcb-template-card .wdt_img img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.wpcb-template-card h3,
.wpcb-template-card .wpcb-result-excerpt,
.wpcb-template-card .more-link,
.wpcb-template-card .wpcb-post-type-badge {
    padding-left: 20px;
    padding-right: 20px;
}

.wpcb-template-card h3 {
    padding-top: 20px;
}

.wpcb-template-card .more-link {
    display: inline-block;
    padding-bottom: 20px;
}

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

@media (max-width: 768px) {
    .wpcb-search-input-wrapper {
        flex-direction: column;
    }

    .wpcb-search-button {
        justify-content: center;
    }

    .wpcb-search-button-text {
        display: inline;
    }

    .wpcb-page-link {
        min-width: 40px;
        height: 40px;
        padding: 6px 10px;
        font-size: 14px;
    }

    .wpcb-template-card .wpcb-results-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .wpcb-pagination-list {
        gap: 3px;
    }

    .wpcb-page-link {
        min-width: 36px;
        height: 36px;
        padding: 4px 8px;
        font-size: 13px;
    }

    .wpcb-page-item.wpcb-ellipsis {
        display: none;
    }
}
