/**
 * LineagePress Search Styles
 */

/* Search Container */
.hp-search-container {
    max-width: 800px;
    margin: 0 auto 30px;
    position: relative;
}

/* Full search page centering */
body.genealogy-search .hp-search-container,
.genealogy-search-page .hp-search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

body.genealogy-search .entry-content,
.genealogy-search-page .entry-content {
    max-width: none;
    margin: 0 auto;
    text-align: left;
}

/* Search Form */
.hp-search-form {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.hp-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 25px !important;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hp-search-input {
    flex: 1;
    padding: 12px 20px;
    border: none !important;
    outline: none;
    font-size: 16px;
    background: transparent;
    border-radius: 25px 0 0 25px !important;
}

.hp-search-input-wrapper:focus-within {
    border-color: #004466;
    box-shadow: 0 0 0 3px rgba(0,68,102,0.1);
}

.hp-search-submit {
    background: #1fb3e3;
    border: none !important;
    color: white;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 16px;
    border-radius: 0 25px 25px 0 !important;
    min-width: 60px;
}

.hp-search-submit:hover {
    background: #003355;
}

.hp-search-icon {
    font-size: 14px;
}

/* Search Suggestions */
.hp-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.hp-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.hp-suggestion-item:hover,
.hp-suggestion-item.active {
    background: #f8f9fa;
}

.hp-suggestion-item:last-child {
    border-bottom: none;
}

/* Search Filters */
.hp-search-filters {
    border-top: 1px solid #e1e5e9;
    padding-top: 15px;
    margin-top: 15px;
}

.hp-search-filter-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.hp-search-filter-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #555;
}

.hp-search-filter-row select,
.hp-search-filter-row input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.hp-search-filter-row input[type="checkbox"] {
    margin: 0;
}

.hp-search-toggle-filters {
    background: none;
    border: 1px solid #004466;
    color: #004466;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.hp-search-toggle-filters:hover {
    background: #004466;
    color: white;
}

/* Search Results */
.hp-search-results {
    margin-top: 30px;
}

.hp-search-loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

.hp-search-loading:before {
    content: "🔍";
    display: block;
    font-size: 24px;
    margin-bottom: 10px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hp-search-results-content {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.hp-no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.hp-search-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 20px;
}

/* Results Sections */
.hp-results-section {
    border-bottom: 1px solid #e1e5e9;
}

.hp-results-section:last-child {
    border-bottom: none;
}

.hp-results-title {
    background: #f8f9fa;
    padding: 15px 20px;
    margin: 0;
    font-size: 18px;
    color: #004466;
    border-bottom: 1px solid #e1e5e9;
}

.hp-results-list {
    padding: 0;
}

/* Scrollable results */
.hp-results-scrollable {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
}

.hp-results-scrollable::-webkit-scrollbar {
    width: 8px;
}

.hp-results-scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.hp-results-scrollable::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.hp-results-scrollable::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Expand search icon */
.hp-expand-search {
    float: right;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.hp-expand-search:hover {
    background: #f0f0f0;
    color: #004466;
    transform: scale(1.1);
}

/* Result Items */
.hp-result-item {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.hp-result-item:hover {
    background: #f8f9fa;
}

.hp-result-item:last-child {
    border-bottom: none;
}

.hp-result-item h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.hp-result-item h4 a {
    color: #004466;
    text-decoration: none;
    font-weight: 600;
}

.hp-result-item h4 a:hover {
    text-decoration: underline;
}

.hp-result-item > div {
    margin-bottom: 5px;
    font-size: 14px;
    color: #666;
}

.hp-result-item > div:last-child {
    margin-bottom: 0;
}

/* Person Items */
.hp-person-item .hp-person-birth,
.hp-person-item .hp-person-death {
    margin-bottom: 8px;
}

.hp-person-item .hp-person-relationship {
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
    margin-bottom: 10px;
}

.hp-person-actions {
    margin-top: 10px;
}

.hp-relationship-search {
    background: #004466;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 4px;
    transition: background-color 0.3s ease;
}

.hp-relationship-search:hover {
    background: #003355;
}

/* Family Items */
.hp-family-item .hp-family-marriage {
    color: #666;
}

/* Place Items */
.hp-place-item .hp-place-location {
    color: #666;
    font-style: italic;
}

.hp-place-item .hp-place-count {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
    margin-top: 5px;
}

/* Source Items */
.hp-source-item .hp-source-text {
    color: #666;
    line-height: 1.4;
    margin-bottom: 8px;
}

.hp-source-item .hp-source-citations {
    background: #fff3e0;
    color: #f57c00;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
}

/* Relationship Results */
.hp-relationship-results h3 {
    background: #004466;
    color: white;
    padding: 15px 20px;
    margin: 0 0 20px 0;
    border-radius: 8px 8px 0 0;
}

/* Pagination */
.hp-search-pagination {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.hp-search-pagination a {
    color: #004466;
    text-decoration: none;
    padding: 8px 16px;
    margin: 0 5px;
    border: 1px solid #004466;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.hp-search-pagination a:hover {
    background: #004466;
    color: white;
}

.hp-search-pagination span {
    padding: 8px 16px;
    margin: 0 5px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hp-search-container {
        margin: 0 15px 20px;
    }
    
    .hp-search-form {
        padding: 15px;
    }
    
    .hp-search-filter-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .hp-search-filter-row label {
        justify-content: space-between;
    }
    
    .hp-result-item {
        padding: 15px;
    }
    
    .hp-results-title {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    .hp-relationship-search {
        display: block;
        width: 100%;
        margin-bottom: 8px;
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .hp-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .hp-search-pagination {
        padding: 15px;
    }
    
    .hp-search-pagination a,
    .hp-search-pagination span {
        display: block;
        margin: 5px 0;
    }
}