/**
 * PDF Search - Frontend Styles
 * Styles for the public-facing search box
 */

/* Main Container */
#pdf-search-container {
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.pdf-search-wrapper {
    max-width: 700px;
    margin: 0 auto;
}

/* Reset all inherited WordPress theme styles */
#pdf-search-container input[type="text"],
#pdf-search-container input[type="search"],
.pdf-search-wrapper input[type="text"],
.pdf-search-wrapper input[type="search"] {
    height: 45px !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    border: 2px solid #ddd !important;
    border-radius: 6px !important;
    background-color: #fff !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
    display: block !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    padding-left: 55px !important;
}

/* Search Box */
.pdf-search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center !important;
    position: relative;
}

/* Search Icon */
.pdf-search-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
}

.pdf-search-input {
    flex: 1;
    height: 45px !important;
    padding: 12px 16px 12px 55px !important;
    font-size: 14px !important;
    border: 2px solid #ddd !important;
    border-radius: 6px !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    box-sizing: border-box !important;
    background-color: #fff !important;
    line-height: 21px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    color: #333 !important;
    margin: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    vertical-align: middle !important;
}

.pdf-search-input:focus {
    outline: none !important;
    border: 1px solid #ddd !important;
    background: #FFF !important;
    color: #333 !important;
    box-shadow: 0 0 0 1px rgba(0, 130, 198, 0.15) !important;
}

.pdf-search-input:focus-visible {
    outline: none !important;
    border: 1px solid #ddd !important;
    box-shadow: 0 0 0 1px rgba(0, 130, 198, 0.15) !important;
}

.pdf-search-input::placeholder {
    color: #999 !important;
    padding-left: 0 !important;
}

.pdf-search-input::-webkit-input-placeholder {
    color: #999 !important;
}

.pdf-search-input:-moz-placeholder {
    color: #999 !important;
    opacity: 1 !important;
}

.pdf-search-input::-moz-placeholder {
    color: #999 !important;
    opacity: 1 !important;
}

.pdf-search-btn {
    padding: 0 28px !important;
    background: #0073aa !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 45px !important;
    margin: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    line-height: 45px !important;
    box-sizing: border-box !important;
}

.pdf-search-btn:hover:not(:disabled) {
    background: #005a87 !important;
    color: #fff !important;
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3) !important;
}

.pdf-search-btn:active:not(:disabled) {
    background: #004a70 !important;
    color: #fff !important;
}

.pdf-search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Status Messages */
.pdf-search-status {
    margin-bottom: 15px;
}

.pdf-loading {
    text-align: center;
    color: #0073aa;
    font-weight: 600;
    padding: 12px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pdf-error {
    background: #fee;
    color: #c00;
    padding: 12px 16px;
    border-left: 4px solid #c00;
    border-radius: 4px;
    font-size: 14px;
}

/* Results Section */
.pdf-search-results {
    animation: fadeIn 0.3s ease;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Show background only when there are results */
.pdf-search-results.has-results {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    padding-right: 28px;
    margin-top: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pdf-results-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* Result Items */
.pdf-result-item {
    display: flex;
    gap: 12px;
    background: #f9f9f9;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pdf-result-item:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.pdf-result-number {
    min-width: 28px;
    height: 28px;
    background: #0073aa;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.pdf-result-content {
    flex: 1;
    min-width: 0;
}

/* Result Name (Link) */
.pdf-result-name {
    display: inline-block;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none !important;
    font-size: 15px;
    margin-bottom: 8px;
    word-break: break-word;
    transition: color 0.3s ease;
}

.pdf-result-name:hover {
    color: #005a87;
    text-decoration: none !important;
}

/* Snippet */
.pdf-result-snippet {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    word-break: break-word;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Highlight matched text */
.pdf-result-snippet strong.highlight {
    background: #fff59d;
    color: #333;
    font-weight: 700;
    padding: 0 2px;
    border-radius: 2px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .pdf-search-box {
        flex-direction: column;
        gap: 10px;
    }

    .pdf-search-input,
    .pdf-search-btn {
        width: 100%;
    }

    .pdf-result-item {
        flex-direction: column;
        gap: 10px;
    }

    .pdf-result-number {
        align-self: flex-start;
    }

    .pdf-search-wrapper {
        margin: 0 10px;
    }
}


/* Loading skeleton (optional) */
.pdf-result-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Custom Scrollbar for Results */
.pdf-search-results::-webkit-scrollbar {
    width: 10px;
}

.pdf-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.pdf-search-results::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.pdf-search-results::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox scrollbar */
.pdf-search-results {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}



@media (max-width: 767px) {
    .pdf-search-icon{
        top:24%;
    }
}