/**
 * UNCDF Search Styles
 * File: uncdf-search.css
 * Location: Upload as Static Resource to Salesforce
 * 
 * Matches existing UNCDF design system:
 * - Primary blue: #0a2463, #0468B1
 * - Gradient: linear-gradient(135deg, #0a2463 0%, #3e92cc 100%)
 * - Background: #f7fafc
 * - Text: #1e293b, #475569, #64748b
 */

/* ==============================================
   UNIVERSAL RESET
   ============================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f7fafc;
    color: #1e293b;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ==============================================
   HEADER SECTION
   ============================================== */
.search-results-header {
    background: white;
    color: #1e293b;
    padding: 32px 0 40px 0;
    box-shadow: none;
}

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0a2463;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.back-link:hover {
    background: #f8fafc;
    border-color: #0a2463;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #0a2463;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: #f8fafc;
}

.search-header-content {
    text-align: center;
    margin-bottom: 32px;
}

.search-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.2;
}

.search-subtitle {
    font-size: 16px;
    opacity: 0.95;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ==============================================
   SEARCH AGAIN BOX
   ============================================== */
.search-again-box {
    max-width: 600px;
    margin: 0 auto;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.search-again-input {
    flex: 1;
    margin: 0px 20px;
    border: none;
    font-size: 16px;
    color: #1e293b;
    outline: none;
}

.search-again-input::placeholder {
    color: #94a3b8;
}

.search-again-btn {
    padding: 20px;
    background: #0a2463;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-again-btn:hover {
    background: #0468B1;
}

.search-again-btn i {
    font-size: 16px;
}

/* ==============================================
   MAIN CONTENT
   ============================================== */
.search-results-main {
    padding: 40px 0;
    min-height: 60vh;
}

/* ==============================================
   RESULTS PANELS
   ============================================== */
.results-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 32px;
    overflow: hidden;
}

.panel-header {
    background: #f8fafc;
    padding: 24px 32px;
    border-bottom: 2px solid #e2e8f0;
}

.panel-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.panel-title {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-title i {
    color: #0a2463;
    font-size: 20px;
}

.panel-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-badge.instant {
    background: #dcfce7;
    color: #15803d;
}

.panel-badge.deep {
    background: #dbeafe;
    color: #1e40af;
}

.panel-description {
    font-size: 14px;
    color: #64748b;
}

/* ==============================================
   LOADING STATE
   ============================================== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
}

.loading-state p {
    font-size: 16px;
    color: #64748b;
    margin-top: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #0a2463;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==============================================
   RESULTS CONTAINER
   ============================================== */
.results-container {
    padding: 32px;
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.results-section.deep-results {
    background: #fafbfc;
    padding: 24px;
    border-radius: 8px;
}

/* ==============================================
   RESULT CATEGORY
   ============================================== */
.result-category {
    margin-bottom: 32px;
}

.result-category:last-child {
    margin-bottom: 0;
}

.result-category h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.result-category h3 i {
    color: #0a2463;
    font-size: 16px;
}

/* ==============================================
   RESULT CARDS (Quick Results)
   ============================================== */
.result-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.result-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #0a2463;
}

.result-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.result-card-header strong {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.project-id-display {
    font-family: 'Courier New', Courier, monospace;
    color: #0a2463;
    font-size: 14px;
}

.result-badge {
    display: inline-flex;
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.result-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.result-value {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.result-card-footer {
    display: flex;
    justify-content: flex-end;
}

.result-link {
    font-size: 13px;
    font-weight: 600;
    color: #0a2463;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==============================================
   RESULT LIST (Deep Results)
   ============================================== */
.result-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-list-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-list-item:hover {
    background: #f8fafc;
    border-color: #0a2463;
    transform: translateX(4px);
}

.result-list-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-list-content strong {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.result-meta {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.result-arrow {
    color: #cbd5e0;
    font-size: 14px;
    transition: all 0.2s ease;
}

.result-list-item:hover .result-arrow {
    color: #0a2463;
    transform: translateX(4px);
}

/* ==============================================
   EMPTY STATE
   ============================================== */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: #64748b;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: #94a3b8;
}

/* ==============================================
   NO RESULTS PANEL
   ============================================== */
.no-results-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 60px 40px;
    text-align: center;
}

.no-results-content h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.no-results-content > p {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 32px;
}

.suggestions {
    max-width: 600px;
    margin: 0 auto;
    background: #f8fafc;
    border-radius: 8px;
    padding: 24px;
    text-align: left;
}

.suggestions h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
}

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

.suggestions li {
    padding: 8px 0;
    font-size: 14px;
    color: #475569;
    position: relative;
    padding-left: 24px;
}

.suggestions li::before {
    content: '•';
    position: absolute;
    left: 8px;
    color: #0a2463;
    font-weight: 700;
}

/* ==============================================
   FOOTER
   ============================================== */
.search-results-footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 32px 0;
    margin-top: 40px;
}

.footer-content {
    text-align: center;
}

.footer-content p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-content i {
    color: #0a2463;
}

.footer-help {
    font-size: 13px;
}

.footer-help a {
    color: #0a2463;
    text-decoration: none;
    font-weight: 600;
}

.footer-help a:hover {
    text-decoration: underline;
}

/* ==============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================== */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .search-results-header {
        padding: 20px 0 32px 0;
    }

    .header-nav {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 24px;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 13px;
        padding: 8px 12px;
    }

    .search-title {
        font-size: 24px;
    }

    .search-subtitle {
        font-size: 14px;
    }

    .search-again-input {
        padding: 16px 20px;
        font-size: 14px;
    }

    .search-again-btn {
        padding: 16px 20px;
    }

    .search-results-main {
        padding: 24px 0;
    }

    .panel-header {
        padding: 20px;
    }

    .panel-title {
        font-size: 20px;
    }

    .panel-title-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .results-container {
        padding: 20px;
    }

    .result-cards {
        grid-template-columns: 1fr;
    }

    .result-category h3 {
        font-size: 16px;
    }

    .loading-state {
        padding: 40px 20px;
    }

    .no-results-panel {
        padding: 40px 20px;
    }

    .no-results-content h2 {
        font-size: 22px;
    }

    .suggestions {
        padding: 20px;
    }
}

/* ==============================================
   PRINT STYLES
   ============================================== */
@media print {
    .search-again-box,
    .header-nav,
    .search-results-footer {
        display: none;
    }

    .search-results-header {
        background: white;
        color: black;
    }

    .result-card,
    .result-list-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
