/**
 * ExpertCE Search Widget Styles
 *
 * Responsive, modern design with smooth animations
 *
 * @package ExpertCE
 * @since 1.0.0
 */

/* ========================================
   Blog Page Wrapper
   ======================================== */

.expertce-search-blog-page {
    clear: both;
    width: 100%;
    margin: 0 0 40px 0 !important;
    padding: 0 !important;
    background: #fff;
    position: relative;
    z-index: 1;
}

/* Compact spacing for blog wrapper */
.expertce-search-blog-wrapper .expertce-search-container {
    padding: 0 20px !important;
}

.expertce-search-blog-wrapper .expertce-search-hero {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.expertce-search-blog-wrapper .expertce-search-bar {
    margin-bottom: 40px !important;
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* ========================================
   Container & Layout
   ======================================== */

.expertce-search-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Compact mode for shortcode usage */
.expertce-search-widget-shortcode .expertce-search-container {
    padding: 10px 20px;
}

.expertce-search-widget-shortcode .expertce-search-hero {
    margin-bottom: 20px;
}

.expertce-search-widget-shortcode .expertce-search-bar {
    margin-bottom: 0;
}

/* ========================================
   Hero Search Section
   ======================================== */

.expertce-search-hero {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 20px;
}

.expertce-search-title {
    font-size: 32px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 24px 0;
    line-height: 1.2;
}

/* Search Bar */
.expertce-search-bar {
    position: relative;
    max-width: 700px;
    margin: 0 0 24px 0;
}

.expertce-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #ffffff 0%, #fffef8 100%);
    border: 1px solid #ffb606;
    border-radius: 50px;
    padding: 0 60px 0 56px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 12px rgba(255, 182, 6, 0.12),
                0 1px 3px rgba(255, 182, 6, 0.06);
}

.expertce-search-input-wrapper:hover {
    border-color: #e6a305;
    box-shadow: 0 4px 16px rgba(255, 182, 6, 0.18),
                0 2px 6px rgba(255, 182, 6, 0.1);
}

.expertce-search-input-wrapper:focus-within {
    background: #ffffff;
    border-color: #cc8f05;
    box-shadow: 0 4px 20px rgba(255, 182, 6, 0.22),
                0 2px 8px rgba(255, 182, 6, 0.12),
                0 0 0 3px rgba(255, 182, 6, 0.08);
}

.expertce-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffb606;
    pointer-events: none;
    transition: color 0.3s ease;
}

.expertce-search-input-wrapper:focus-within .expertce-search-icon {
    color: #cc8f05;
}

.expertce-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 16px;
    font-weight: 400;
    padding: 18px 0;
    background: transparent;
    color: #1d2327;
    letter-spacing: 0.01em;
}

.expertce-search-input:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.expertce-search-input::placeholder {
    color: #6c757d;
    font-weight: 400;
}

.expertce-search-clear {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #757575;
    transition: color 0.2s ease;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.expertce-search-clear:hover {
    color: #d63638;
}

.expertce-search-loading {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
}

.expertce-search-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   Post Type Toggle
   ======================================== */

.expertce-post-type-toggle {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.post-type-btn {
    background: #f7f7f7;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
}

.post-type-btn:hover {
    background: #fff;
    border-color: #0073aa;
    color: #0073aa;
}

.post-type-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

/* ========================================
   Profession Filter Pills
   ======================================== */

.expertce-profession-filter {
    margin-bottom: 20px;
}

.profession-pills-wrapper {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.profession-pill {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
}

.profession-pill:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.profession-pill.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

/* ========================================
   Trending Section
   ======================================== */

.expertce-trending-section {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
}

.trending-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 16px 0;
}

.trending-icon {
    color: #f56e28;
}

.trending-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.trending-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 12px;
}

.trending-item:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
    transform: translateY(-2px);
}

.trending-item-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.4;
}

.trending-item-views {
    font-size: 12px;
    color: #757575;
    white-space: nowrap;
}

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

.expertce-search-results {
    margin-top: 30px;
}

/* Results Header */
.expertce-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e0e0e0;
}

.results-count {
    font-size: 16px;
    color: #555;
}

.count-number {
    font-weight: 700;
    color: #0073aa;
    font-size: 20px;
}

.expertce-sort-select {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.expertce-sort-select:focus {
    outline: none;
    border-color: #0073aa;
}

/* Best Match Section */
.expertce-best-match {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #0073aa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.best-match-label {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.best-match-card {
    background: #fff;
    border: none !important;
}

/* Results Grid */
.expertce-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

/* Result Card */
.expertce-result-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.expertce-result-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
    border-color: #0073aa;
}

.result-card-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #f0f0f0;
}

.thumbnail-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.thumbnail-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.expertce-result-card:hover .thumbnail-link img {
    transform: scale(1.05);
}

.result-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.result-card-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.title-link {
    color: #1d2327;
    text-decoration: none;
    transition: color 0.2s ease;
}

.title-link:hover {
    color: #0073aa;
}

.result-card-profession {
    display: inline-block;
    background: #f0f0f0;
    color: #555;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 12px;
    align-self: flex-start;
}

.result-card-excerpt {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin: 0 0 16px 0;
    flex: 1;
}

.result-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #757575;
}

.meta-item svg {
    color: #999;
}

/* ========================================
   Load More Button
   ======================================== */

.expertce-load-more-wrapper {
    text-align: center;
    margin: 30px 0;
}

.expertce-load-more-btn {
    background: #fff;
    border: 2px solid #0073aa;
    color: #0073aa;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 32px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.expertce-load-more-btn:hover {
    background: #0073aa;
    color: #fff;
}

.expertce-load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.expertce-load-more-btn svg {
    transition: transform 0.3s ease;
}

.expertce-load-more-btn:hover svg {
    transform: translateY(2px);
}

/* ========================================
   Skeleton Loader
   ======================================== */

.expertce-skeleton-loader {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.skeleton-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.skeleton-thumbnail {
    width: 100%;
    padding-top: 56.25%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-content {
    padding: 20px;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-title {
    height: 20px;
    width: 80%;
}

.skeleton-excerpt {
    width: 100%;
}

.skeleton-meta {
    width: 60%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   Empty State
   ======================================== */

.expertce-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    color: #ccc;
    margin-bottom: 20px;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 8px 0;
}

.empty-state-text {
    font-size: 16px;
    color: #757575;
    margin: 0 0 24px 0;
}

.empty-state-suggestions {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    margin: 0 auto;
    text-align: left;
}

.empty-state-suggestions p {
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #555;
}

.empty-state-suggestions ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.empty-state-suggestions li {
    padding: 6px 0;
    color: #757575;
    font-size: 14px;
}

.empty-state-suggestions li:before {
    content: "→";
    margin-right: 8px;
    color: #0073aa;
}

/* ========================================
   Error Message
   ======================================== */

.expertce-error-message {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #856404;
}

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

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .expertce-results-grid,
    .expertce-skeleton-loader {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .trending-items {
        grid-template-columns: 1fr 1fr;
    }
}

/* Mobile (up to 767px) */
@media (max-width: 767px) {
    .expertce-search-container {
        padding: 16px;
    }

    .expertce-search-title {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .expertce-search-input-wrapper {
        padding: 0 50px 0 48px;
    }

    .expertce-search-input {
        font-size: 15px;
        padding: 16px 0;
    }

    .expertce-search-icon {
        left: 16px;
    }

    .expertce-search-clear {
        right: 16px;
    }

    .expertce-post-type-toggle {
        gap: 8px;
    }

    .post-type-btn {
        font-size: 13px;
        padding: 8px 16px;
    }

    .profession-pills-wrapper {
        gap: 8px;
    }

    .profession-pill {
        font-size: 12px;
        padding: 6px 14px;
    }

    .trending-items {
        grid-template-columns: 1fr;
    }

    .expertce-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .expertce-results-grid,
    .expertce-skeleton-loader {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .result-card-title {
        font-size: 16px;
    }

    .result-card-content {
        padding: 16px;
    }

    .result-card-meta {
        gap: 12px;
    }

    .expertce-load-more-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    .expertce-search-input-wrapper {
        border-radius: 12px;
        padding: 0 44px 0 44px;
    }

    .expertce-search-input {
        font-size: 14px;
        padding: 14px 0;
    }

    .post-type-btn {
        flex: 1;
        min-width: 100px;
    }

    .profession-pill {
        flex: 1 1 auto;
        min-width: 100px;
        text-align: center;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .expertce-search-bar,
    .expertce-post-type-toggle,
    .expertce-profession-filter,
    .expertce-results-header,
    .expertce-load-more-wrapper {
        display: none;
    }

    .expertce-result-card {
        break-inside: avoid;
        border: 1px solid #000;
    }
}

/* ========================================
   Accessibility Enhancements
   ======================================== */

/* Focus visible for keyboard navigation */
.expertce-search-input:focus-visible,
.post-type-btn:focus-visible,
.profession-pill:focus-visible,
.expertce-load-more-btn:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .expertce-search-input-wrapper {
        border-width: 3px;
    }

    .post-type-btn,
    .profession-pill {
        border-width: 3px;
    }

    .expertce-result-card {
        border-width: 2px;
    }
}
