/**
 * EDC Advanced Search - Frontend Styles
 * Matches the provided UI design
 */

.edc-search-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    width: 100%;
    position: relative;
}

/* Search Form */
.edc-search-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
    position: relative;
}

/* Container for input + button */
.edc-search-wrapper {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    width: 100% !important;
    position: relative; /* Required for dropdown */
    gap: 0 !important;
}

.edc-search-form {
    width: 100%;
    position: relative;
}

.edc-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

/* SEARCH INPUT */
#edc-search-q,
input#edc-search-q {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
    padding: 0 16px !important;
    font-size: 16px;
    line-height: normal !important;
    border: 1px solid #c9c9c9;
    border-radius: 8px 0 0 8px !important; /* Rounded left side */
    border-right: none !important;
    box-sizing: border-box;
    margin: 0 !important;
    display: block;
    position: relative;
    z-index: 1;
}

.edc-search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid #cccccc;
    border-radius: 6px;
    box-sizing: border-box;
}

.edc-input:focus {
    border-color: #0a5;
    box-shadow: 0 0 0 2px rgba(0, 170, 85, 0.1);
}

.edc-button {
    background-color: #0a5;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

/* SEARCH BUTTON — DEFAULT STATE */
.edc-search-btn,
#edc-search-button,
button.edc-search-btn,
button#edc-search-button {
    flex: 0 0 auto !important;
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
    padding: 0 25px !important;
    line-height: 1 !important;
    background-color: #007476 !important;
    color: #fff !important;
    border: 1px solid #007476 !important;
    border-left: none !important;
    border-radius: 0 8px 8px 0 !important; /* Rounded right side */
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    transition: 0.2s ease-in-out;
    margin: 0 !important;
    box-sizing: border-box;
    display: inline-block;
    position: relative;
    z-index: 1;
}

/* SEARCH BUTTON — HOVER STATE */
.edc-search-btn:hover,
#edc-search-button:hover {
    background-color: #ffffff !important;
    color: #007476 !important;
    border: 1px solid #007476 !important;
}

.edc-button:hover {
    background-color: #088;
}

.edc-button:active {
    background-color: #066;
}

/* Suggestions Dropdown */
.edc-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    display: none;
    z-index: 1000;
    max-width: 100%;
}

.edc-search-form {
    position: relative;
}

.edc-suggestions-list {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 450px;
    overflow-y: auto;
    z-index: 1000;
    width: 100%;
}

.edc-suggestions-section {
    padding: 0;
    border-bottom: 1px solid #eee;
}

.edc-suggestions-section:last-child {
    border-bottom: none;
}

.edc-suggestions-section strong {
    display: block;
    padding: 0.75rem 1rem;
    color: #666;
    font-size: 0.8125rem;
    text-transform: uppercase;
    font-weight: 600;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.edc-suggestions-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.edc-suggestions-section li {
    margin: 0;
}

.edc-suggestions-section a {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f5f5f5;
}

.edc-suggestions-section a:last-child {
    border-bottom: none;
}

.edc-suggestions-section a:hover {
    background-color: #f0f8ff;
    color: #0a5;
}

.edc-suggestions-section mark {
    background-color: #ffeb3b;
    padding: 0;
}

/* Trending Keywords - Hidden */
.edc-trending {
    display: none !important;
    margin-bottom: 1.5rem;
    margin-top: 1rem;
}

.edc-trending-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.edc-trending-chip {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.875rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 400;
}

.edc-trending-chip:hover {
    background-color: #0a5;
    color: white;
    border-color: #0a5;
}

/* Search Layout */
.edc-search-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 2rem;
}

/* Ensure results area is properly separated from filters */
.edc-results-wrapper {
    margin-top: 20px !important;
}

/* Facets Sidebar */
.edc-facets {
    flex: 0 0 280px;
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-family: "Varela Round", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.facet-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin: 0 0 1.25rem 0;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #ddd;
}

/* Reduce gap between Content Type section and Event Status heading */
.edc-filter-wrapper + .facet-title,
.edc-filter-wrapper + .edc-filter-title,
h3.facet-title.edc-filter-title {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
}

/* Ensure the last divider doesn't add extra space */
.edc-filter-section--content-type .edc-filter-divider:last-of-type {
    margin-bottom: 0.5rem !important;
}

/* Equal spacing for all filter sections */
.edc-filter-divider {
    margin: 12px 0 !important;
}

.facet-group {
    margin-bottom: 0.75rem;
}

.facet-group:last-child {
    margin-bottom: 0;
}

/* Ensure facet groups inside filter wrapper don't add extra space */
.edc-filter-wrapper .facet-group {
    margin-bottom: 0;
}

.edc-facet-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    cursor: pointer;
    font-size: 0.9375rem;
}

.edc-facet-item input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.edc-facet-label {
    flex: 1;
    color: #333;
}

.edc-facet-count {
    color: #666;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.edc-no-facets {
    color: #999;
    font-size: 0.875rem;
    font-style: italic;
    margin: 0;
}

/* Results Main Area */
.edc-results-main {
    flex: 1;
    min-width: 0;
}

.edc-results-count {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1.5rem;
    font-weight: 500;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

/* Active Filters */
.edc-active-filters {
    margin-bottom: 1rem;
}

.edc-active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.875rem;
    color: #666;
}

.edc-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: #e8f5e9;
    border: 1px solid #0a5;
    border-radius: 20px;
    color: #0a5;
    font-size: 0.875rem;
}

.edc-filter-remove {
    background: none;
    border: none;
    color: #0a5;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.edc-filter-remove:hover {
    background-color: rgba(0, 170, 85, 0.1);
}

/* Search Results */
.edc-search-results {
    list-style: none;
    margin: 0;
    padding: 0;
}

.edc-results-main {
    min-height: 400px;
}

.edc-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s, transform 0.2s;
}

.edc-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.edc-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.edc-type {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background-color: #e0e0e0;
    color: #666;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: lowercase;
    border-radius: 12px;
    letter-spacing: 0.3px;
}

.edc-date {
    color: #999;
    font-size: 0.875rem;
}

.edc-title {
    display: block;
    color: #0a5;
    font-weight: 600;
    font-size: 1.125rem;
    text-decoration: underline;
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
    line-height: 1.5;
    transition: color 0.2s;
}

.edc-title:hover {
    color: #088;
}

.edc-snippet {
    color: #666;
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
}

.edc-snippet mark {
    background-color: #ffeb3b;
    padding: 0 2px;
    font-weight: 500;
}

.edc-download {
    display: inline-block;
    color: #0a5;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.edc-download:hover {
    text-decoration: underline;
}

/* Status Message */
.edc-status {
    padding: 10px;
    color: #555;
    font-style: italic;
    text-align: center;
}

/* Searching Spinner */
.edc-spinner {
    padding: 12px;
    text-align: center;
    font-style: italic;
    color: #555;
}

/* Filter wrapper (column) */
.edc-filter-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.edc-filter-section {
    margin-bottom: 0;
}

.edc-filter-section--content-type {
    margin-bottom: 0;
}

.filter-type {
    margin-right: 6px;
}

/* Section titles */
.edc-filter-section--content-type .edc-filter-title,
.edc-filter-title {
    font-family: "Varela Round", sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* Checkboxes */
.edc-filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: "Varela Round", sans-serif;
    font-size: 14px;
    margin: 4px 0 8px;
}

/* Horizontal divider */
.edc-filter-divider {
    border: 0;
    border-top: 1px solid #e2e2e2;
    margin: 10px 0 12px;
}

/* Row for label + dropdown on same line - FORCE HORIZONTAL LAYOUT */
.edc-filter-row,
.edc-filter-section--content-type .edc-filter-row,
div.edc-filter-row.edc-filter-row--nested {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    margin: 4px 0 6px !important;
    width: 100% !important;
    min-height: 34px !important;
}

/* Indent nested rows under Posts & Files */
.edc-filter-row--nested,
.edc-filter-section--content-type .edc-filter-row--nested {
    padding-left: 24px !important;
}

/* Label on the left in row */
.edc-filter-row-label,
.edc-filter-row .edc-filter-row-label,
span.edc-filter-row-label {
    font-family: "Varela Round", sans-serif !important;
    font-size: 14px !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    margin-right: 10px !important;
    display: inline-block !important;
}

/* Container for the select on the right */
.edc-filter-row-control,
.edc-filter-row .edc-filter-row-control,
div.edc-filter-row-control {
    flex: 0 0 auto !important;
    margin-left: auto !important;
    display: inline-block !important;
}

/* Dropdown styling */
.edc-filter-select,
select.edc-filter-select,
.edc-filter-row-control .edc-filter-select,
.edc-filter-row-control select {
    width: 140px !important;
    height: 34px !important;
    font-family: "Varela Round", sans-serif !important;
    font-size: 13px !important;
    border-radius: 4px !important;
    border: 1px solid #d4d4d4 !important;
    padding: 4px 8px 4px 12px !important;
    box-sizing: border-box !important;
    display: inline-block !important;
}

.edc-facet-hidden {
    display: none;
}

/* Toast Messages */
.edc-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity .3s;
    z-index: 9999;
}

.edc-toast.show {
    opacity: 1;
}

/* No Results */
.edc-no-results {
    background: #f5f5f5;
    border-radius: 6px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
}

.edc-no-results-content h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.edc-no-results-content p {
    color: #666;
    margin-bottom: 1.5rem;
}

.edc-no-results-content #edc-clear-search {
    margin-top: 1rem;
}

.edc-clear-filters {
    margin-top: 1rem;
}


/* Pagination */
.edc-pagination {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.edc-pagination-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.edc-page-btn {
    padding: 0.5rem 1rem;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.edc-page-btn:hover {
    background-color: #0a5;
    color: white;
    border-color: #0a5;
}

.edc-page-current {
    padding: 0.5rem 1rem;
    background-color: #0a5;
    color: white;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 600;
}

.edc-page-ellipsis {
    padding: 0.5rem;
    color: #999;
}

/* Error State */
.edc-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 1rem;
    color: #856404;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .edc-search-container {
        padding: 1.5rem 1rem;
    }
    
    .edc-search-layout {
        gap: 1.5rem;
    }
    
    .edc-facets {
        flex: 0 0 240px;
    }
}

@media (max-width: 768px) {
    .edc-search-layout {
        flex-direction: column;
    }
    
    .edc-facets {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }
    
    .edc-search-form {
        flex-direction: row;
    }
    
    .edc-search-wrapper {
        flex-direction: row !important;
    }
    
    #edc-search-q {
        font-size: 14px;
        height: 45px !important;
        min-height: 45px !important;
        max-height: 45px !important;
    }
    
    .edc-search-btn,
    #edc-search-button {
        height: 45px !important;
        min-height: 45px !important;
        max-height: 45px !important;
        padding: 0 20px !important;
        font-size: 13px;
    }
    
    .edc-button {
        padding: 0.625rem 1.5rem;
    }
    
    .edc-card {
        padding: 1rem;
    }
    
    .edc-card-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .edc-title {
        font-size: 1rem;
    }
    
    .edc-filter-select,
    select.edc-filter-select {
        width: 120px !important;
        font-size: 12px !important;
    }
}

@media (max-width: 480px) {
    .edc-search-container {
        padding: 1rem 0.5rem;
    }
    
    .edc-search-wrapper {
        gap: 0 !important;
    }
    
    #edc-search-q {
        height: 42px !important;
        min-height: 42px !important;
        max-height: 42px !important;
        padding: 0 12px !important;
        font-size: 14px;
    }
    
    .edc-search-btn,
    #edc-search-button {
        height: 42px !important;
        min-height: 42px !important;
        max-height: 42px !important;
        padding: 0 15px !important;
        font-size: 12px;
    }
    
    .edc-facets {
        padding: 1rem;
    }
    
    .edc-card {
        padding: 0.75rem;
    }
    
    .edc-title {
        font-size: 0.9375rem;
    }
    
    .edc-snippet {
        font-size: 0.875rem;
    }
    
    .edc-filter-row {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .edc-filter-row-label {
        margin-bottom: 6px !important;
    }
    
    .edc-filter-select,
    select.edc-filter-select {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .edc-filter-row--nested {
        padding-left: 12px !important;
    }
    
    .edc-active-filters-list {
        font-size: 0.8125rem;
    }
    
    #edc-suggest-box {
        width: calc(100% - 80px) !important;
        max-width: calc(100% - 80px) !important;
    }
}

/* Autocomplete Suggestions Box */
.edc-suggest-box {
    position: absolute;
    top: calc(100% + 2px); /* directly under the search bar */
    left: 0;
    width: 100%;           /* MATCH full width of the search bar */
    background: #ffffff;
    border: 1px solid #e2e2e2;
    border-top: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 9999;
}

/* AUTOSUGGESTION BOX (GOOGLE STYLE) */
#edc-suggest-box {
    position: absolute;
    top: 52px !important;
    left: 0 !important;
    width: calc(100% - 140px) !important;
    max-width: calc(100% - 140px) !important;
    background: #ffffff;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    max-height: 260px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    z-index: 9999;
    margin: 0;
    pointer-events: auto;
}

/* Single suggestion row */
.edc-suggest-item {
    padding: 12px 16px;
    border-bottom: 1px solid #efefef;
    cursor: pointer;
    background: #fff;
}

/* Remove last border */
.edc-suggest-item:last-child {
    border-bottom: none;
}

/* Hover effect */
.edc-suggest-item:hover {
    background: #007476 !important;
    color: #ffffff !important;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 3px;
}

#edc-suggest-box::-webkit-scrollbar {
    width: 6px;
}

#edc-suggest-box::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 3px;
}

/* Do NOT modify search button sizing */

/* Loader container */
.edc-loader {
    padding: 40px 0;
    text-align: center;
}

/* Loader text */
.edc-loader-text {
    margin-top: 12px;
    font-size: 20px;        /* bigger font */
    font-weight: 600;
    color: #007476;         /* site color */
}

/* Animated spinner */
.edc-loader-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto;
    border: 4px solid #cce7e3;
    border-top-color: #007476;
    border-radius: 50%;
    animation: edc-spin 0.8s linear infinite;
}

/* Spinner animation */
@keyframes edc-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Text-only animated loader for \"Searching...\" */
.edc-text-loader {
    margin-top: 30px;
    text-align: center;
    font-size: 30px !important;   /* bigger text */
    font-weight: 700;
    color: #007476;           /* theme color */
    letter-spacing: 2px;
}

.edc-letter {
    display: inline-block;
    opacity: 0.2;
    transform: scale(0.85);
    animation: edc-letter-animate 1.2s infinite;
    animation-delay: calc(0.08s * var(--i));
}

@keyframes edc-letter-animate {
    0%   { opacity: 0.2; transform: scale(0.85); }
    25%  { opacity: 1;   transform: scale(1.3); }   /* POP effect */
    50%  { opacity: 0.8; transform: scale(1.0); }
    100% { opacity: 0.2; transform: scale(0.85); }
}
