/* PixelPDF local search — tool-specific styling. Base colours and chrome come
   from pagesaver_tools.css; this file only adds the search layout. */

.ps-search-wrap {
    max-width: 1080px;
    margin: -20px auto 0;
    padding: 0 24px 80px;
    font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    color: #4b5563;
}

.ps-search-drop {
    border: 1.5px dashed #c3cbbe;
    border-radius: 4px;
    background: #fff;
    padding: 26px 16px;
    text-align: center;
    color: #4b5563;
    font-size: 15px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.ps-search-drop:hover,
.ps-search-drop.ps-drop-active {
    border-color: #28a745;
    background: #f2fbf4;
}

.ps-search-banner {
    margin: 14px 0 0;
    padding: 11px 14px;
    border: 1px solid #eadfca;
    border-radius: 3px;
    background: #fffbf3;
    color: #735420;
    font-size: 13px;
    line-height: 1.5;
}

.ps-search-files {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
}
.ps-search-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid #e4e7df;
    border-radius: 3px;
    background: #fff;
    margin-bottom: 6px;
}
.ps-search-file-name { font-weight: 600; color: #12160f; flex: 1 1 auto; word-break: break-all; }
.ps-search-file-meta { color: #6b7280; font-size: 13px; white-space: nowrap; }
.ps-search-file-remove {
    border: 0; background: transparent; color: #9aa29a; font-size: 20px;
    line-height: 1; cursor: pointer; padding: 0 4px;
}
.ps-search-file-remove:hover { color: #c0392b; }

.ps-search-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 18px 0 8px;
}
.ps-search-query {
    flex: 1 1 320px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid #cad2c6;
    border-radius: 3px;
    font-size: 16px;
    color: #12160f;
}
.ps-search-query:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40,167,69,.12);
    outline: 0;
}
.ps-search-query:disabled { background: #f2f4f0; color: #7b8478; }

.ps-search-modes { display: flex; gap: 14px; font-size: 14px; color: #324353; }
.ps-search-modes label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

.ps-search-actions { display: flex; gap: 8px; }
.ps-search-actions button {
    height: 40px; padding: 0 14px; border-radius: 2px; border: 1px solid #cad2dd;
    background: #fff; color: #485a6d; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ps-search-actions button:hover { background: #f2f5f9; }

.ps-search-statusline { font-size: 14px; color: #12160f; min-height: 20px; margin: 6px 0; }
.ps-search-progress {
    width: 100%; max-width: 600px; height: 8px; background: #efefef;
    border-radius: 99px; overflow: hidden; margin: 4px 0 10px;
}
.ps-search-bar { width: 0%; height: 100%; background: #28a745; transition: width .2s linear; }

.ps-search-count { font-size: 13px; color: #6b7280; margin: 6px 0; }

.ps-search-spin {
    display: inline-block;
    width: 13px; height: 13px;
    border: 2px solid #cfe6d4;
    border-top-color: #28a745;
    border-radius: 50%;
    vertical-align: -2px;
    animation: ps-search-spin 0.7s linear infinite;
}
@keyframes ps-search-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ps-search-spin { animation-duration: 2s; } }

.ps-search-results { list-style: none; margin: 8px 0 0; padding: 0; }
.ps-search-result {
    border: 1px solid #e4e7df; border-radius: 3px; background: #fff;
    padding: 14px 16px; margin-bottom: 10px;
}
.ps-search-result-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ps-search-result-name { font-weight: 700; color: #12160f; word-break: break-all; }
.ps-search-result-page { color: #6b7280; font-size: 13px; white-space: nowrap; }
.ps-search-result-snippet { margin: 0 0 10px; line-height: 1.55; color: #374151; }
.ps-search-result-snippet mark { background: #fff2a8; color: inherit; padding: 0 1px; border-radius: 2px; }
.ps-search-open {
    border: 1px solid #28a745; background: #28a745; color: #fff; font-weight: 600;
    height: 34px; padding: 0 12px; border-radius: 2px; cursor: pointer; font-size: 13px;
}
.ps-search-open:hover { background: #19692c; border-color: #19692c; }

/* Ask AI button + generative answer card */
.ps-search-ask {
    border: 1px solid #28a745 !important;
    background: #28a745 !important;
    color: #fff !important;
}
.ps-search-ask:hover { background: #19692c !important; border-color: #19692c !important; }

.ps-search-answer {
    border: 1px solid #cfe6d4;
    border-left: 3px solid #28a745;
    background: #f6fbf7;
    border-radius: 4px;
    padding: 14px 16px;
    margin: 12px 0 4px;
}
.ps-search-answer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ps-search-answer-title { font-weight: 700; color: #19692c; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.ps-search-answer-head button {
    border: 1px solid #cad2dd; background: #fff; border-radius: 2px; cursor: pointer;
    height: 30px; padding: 0 12px; font-size: 13px; color: #485a6d;
}
.ps-search-answer-status { font-size: 13px; color: #6b7280; min-height: 16px; }
.ps-search-answer-body { font-size: 15px; line-height: 1.6; color: #12160f; white-space: pre-wrap; margin: 4px 0; min-height: 10px; }
.ps-search-answer-note { font-size: 12px; color: #8a7320; background: #fffbf3; border: 1px solid #eadfca; border-radius: 3px; padding: 7px 10px; margin: 8px 0; }
.ps-search-answer-sources { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ps-search-answer-sources-label { flex-basis: 100%; font-size: 12px; color: #6b7280; }
.ps-search-source {
    border: 1px solid #cfe6d4; background: #fff; color: #19692c; border-radius: 99px;
    padding: 4px 11px; font-size: 13px; cursor: pointer;
}
.ps-search-source:hover { background: #eef7f0; border-color: #28a745; }

/* preview dialog */
.ps-search-dialog {
    position: fixed; inset: 0; background: rgba(12,16,15,.55);
    display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.ps-search-dialog-box {
    background: #fff; border-radius: 4px; max-width: 900px; width: 100%;
    max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
}
.ps-search-dialog-bar {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    border-bottom: 1px solid #e4e7df; background: #f7f9f5;
}
.ps-search-dialog-bar button {
    border: 1px solid #cad2dd; background: #fff; border-radius: 2px; cursor: pointer;
    min-width: 34px; height: 34px; padding: 0 10px; font-size: 16px; color: #324353;
}
.ps-search-dialog-bar button:hover { background: #eef2f7; }
.ps-search-dialog-label { flex: 1 1 auto; font-size: 14px; color: #12160f; }
.ps-search-dialog-canvas { overflow: auto; padding: 14px; background: #f4f6f2; text-align: center; }
.ps-search-dialog-canvas canvas { max-width: 100%; height: auto; box-shadow: 0 2px 8px rgba(0,0,0,.12); background: #fff; }
.ps-search-dialog-status { padding: 8px 14px; font-size: 13px; color: #6b7280; min-height: 18px; }

@media (max-width: 640px) {
    .ps-search-wrap { padding: 0 16px 60px; }
    .ps-search-controls { flex-direction: column; align-items: stretch; }
    .ps-search-result-head { flex-direction: column; gap: 2px; }
}
