/* ============================================================
   GLOBAL SEARCH - CSS
   ResiHub AI Platform
   ============================================================ */

/* Search Container */
.global-search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    z-index: 200;
}

/* Search Input */
.global-search-input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border-radius: 30px;
    border: 2px solid transparent;
    background: rgba(255,255,255,0.95);
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    color: #2d3748;
}

.global-search-input:focus {
    outline: none;
    border-color: #18b090;
    box-shadow: 0 4px 25px rgba(24, 176, 144, 0.25);
}

.global-search-input::placeholder {
    color: #a0aec0;
}

.search-icon-overlay {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    font-size: 1rem;
    pointer-events: none;
}

/* Dropdown Results */
.global-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
    z-index: 3000;
    display: none;
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
}

.global-search-results.active {
    display: block;
}

/* Category Headers */
.gs-category-header {
    padding: 10px 16px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #718096;
    background: #f7fafc;
    font-weight: 700;
    letter-spacing: 1px;
    border-bottom: 1px solid #edf2f7;
    position: sticky;
    top: 0;
}

/* Result Items */
.gs-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f7fafc;
    transition: all 0.15s ease;
}

.gs-item:hover {
    background: linear-gradient(135deg, #ebf8ff, #e6fffa);
}

.gs-item:last-child {
    border-bottom: none;
}

.gs-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e2e8f0, #edf2f7);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.gs-icon.customer { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.gs-icon.contractor { background: linear-gradient(135deg, #18b090, #04bfe1); }
.gs-icon.invoice { background: linear-gradient(135deg, #eeae47, #f6ad55); }
.gs-icon.document { background: linear-gradient(135deg, #667eea, #764ba2); }
.gs-icon.work-order { background: linear-gradient(135deg, #48bb78, #38a169); }

.gs-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gs-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-sub {
    font-size: 0.8rem;
    color: #718096;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* No Results */
.gs-no-results {
    padding: 30px;
    text-align: center;
    color: #a0aec0;
}

/* ============================================================
   DOCUMENT VIEWER MODAL
   ============================================================ */

.doc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.doc-modal-overlay.active {
    display: flex;
}

.doc-modal-content {
    background: #fff;
    width: 90%;
    max-width: 900px;
    height: 85vh;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.doc-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #0d4c65, #18b090);
    color: #fff;
}

.doc-modal-header h3 {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 600;
}

.doc-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.doc-modal-close:hover {
    background: rgba(255,255,255,0.3);
}

.doc-modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Preview Pane (Left) */
.doc-preview-pane {
    flex: 1;
    background: #1a202c;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    padding: 20px;
}

.doc-preview-pane img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.doc-preview-placeholder {
    color: #4a5568;
    text-align: center;
    padding: 40px;
}

.doc-preview-placeholder i {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* OCR Text Pane (Right) */
.doc-ocr-pane {
    width: 380px;
    border-left: 1px solid #edf2f7;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.doc-ocr-header {
    padding: 16px 20px;
    border-bottom: 1px solid #edf2f7;
    background: #fff;
}

.doc-ocr-header h4 {
    margin: 0;
    font-size: 0.85rem;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-ocr-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #2d3748;
    white-space: pre-wrap;
    word-break: break-word;
}

.doc-ocr-content:empty::before {
    content: 'No text extracted yet...';
    color: #a0aec0;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .doc-modal-body {
        flex-direction: column;
    }
    .doc-ocr-pane {
        width: 100%;
        height: 40%;
        border-left: none;
        border-top: 1px solid #edf2f7;
    }
}
