/* AI Research Assistant Styles */

/* Main Container */

.postbox{
    padding: 10px !important;
}
.ai-research-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

/* Header */
.ai-search-header {
    text-align: center;
    margin-bottom: 30px;
}

.ai-search-header h2 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
}

.ai-search-header p {
    color: #7f8c8d;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
}

/* Search Form */
.search-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#ai-search-query {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#ai-search-query:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-button {
    padding: 15px 25px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(52, 152, 219, 0.3);
    min-width: 120px;
    justify-content: center;
}

.search-button:hover {
    background: linear-gradient(135deg, #2980b9, #1f639a);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.4);
}

.search-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 20px;
    height: 20px;
}

/* Search Filters */
.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
}

.filter-group input,
.filter-group select {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

/* Results */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #ecf0f1, #bdc3c7);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.results-count {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.export-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-btn {
    padding: 10px 15px;
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.export-btn:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
    transform: translateY(-1px);
}

/* Result Cards */
.result-card {
    border: 1px solid #e1e8ed;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #9b59b6);
}

.result-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.result-number {
    position: absolute;
    top: 15px;
    right: 20px;
    background: linear-gradient(135deg, #6c757d, #495057);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.result-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #2c3e50;
    line-height: 1.4;
    padding-right: 60px; /* Space for result number */
}

.result-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.result-title a:hover {
    color: #3498db;
}

.result-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #7f8c8d;
    flex-wrap: wrap;
    align-items: center;
}

.result-type {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-type.patent {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.patent-status {
    background: #f39c12;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.summary-type {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    color: white;
}

.result-summary {
    line-height: 1.7;
    margin-bottom: 20px;
    color: #34495e;
    font-size: 15px;
}

.result-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.expand-btn {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.expand-btn:hover {
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    transform: translateY(-1px);
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.source-link:hover {
    background: linear-gradient(135deg, #138496, #0f6674);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

/* Pagination */
#pagination-controls {
    margin: 30px 0;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #dee2e6;
}

.pagination-info {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 10px 15px;
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.pagination-btn:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #495057;
}

.pagination-btn.active {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-color: #2980b9;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.pagination-btn.active:hover {
    background: linear-gradient(135deg, #2980b9, #1f639a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    color: #fff;
}

.pagination-btn:disabled {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.pagination-ellipsis {
    padding: 10px 5px;
    color: #6c757d;
    font-weight: bold;
    font-size: 14px;
}

/* Previous/Next Button Styling */
.pagination-btn[data-page]:first-child,
.pagination-btn[data-page]:last-child {
    padding: 10px 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #6c757d, #495057);
    color: #fff;
    border-color: #495057;
}

.pagination-btn[data-page]:first-child:hover,
.pagination-btn[data-page]:last-child:hover {
    background: linear-gradient(135deg, #495057, #343a40);
    border-color: #343a40;
}

/* Messages */
.legal-disclaimer {
    margin-top: 40px;
    padding: 20px;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    font-size: 14px;
    color: #856404;
    line-height: 1.6;
}

.error-message {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    font-weight: 500;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
    font-size: 18px;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.notice {
    margin: 10px 0;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
}

.notice-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner circle {
    animation: spin 2s linear infinite;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ai-research-wrapper {
        padding: 15px;
    }

    .search-input-wrapper {
        flex-direction: column;
    }

    .search-button {
        width: 100%;
        justify-content: center;
    }

    .search-filters {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 15px;
    }

    .results-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .export-options {
        justify-content: center;
    }

    .result-card {
        padding: 20px;
    }

    .result-number {
        position: static;
        display: inline-block;
        margin-bottom: 10px;
    }

    .result-title {
        padding-right: 0;
        font-size: 18px;
    }

    .result-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .result-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .pagination-buttons {
        gap: 5px;
    }
    
    .pagination-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 35px;
    }
    
    .pagination-info {
        font-size: 13px;
        margin-bottom: 12px;
    }
    
    #pagination-controls {
        margin: 20px 0;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .ai-research-wrapper {
        padding: 10px;
    }

    .result-title {
        font-size: 16px;
    }

    .export-options {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
        gap: 10px;
    }

    .export-btn {
        flex: 1;
        justify-content: center;
    }

    .pagination-buttons {
        gap: 3px;
    }
    
    .pagination-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 30px;
    }
    
    .pagination-ellipsis {
        padding: 6px 3px;
    }

    .result-meta {
        font-size: 13px;
    }

    .result-summary {
        font-size: 14px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ai-research-wrapper {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .result-card {
        background: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }

    .result-title {
        color: #f0f0f0;
    }

    .result-title a {
        color: #f0f0f0;
    }

    .result-title a:hover {
        color: #4db8ff;
    }

    .result-summary {
        color: #c0c0c0;
    }

    #ai-search-query {
        background: #2d2d2d;
        border-color: #555;
        color: #e0e0e0;
    }

    #ai-search-query:focus {
        border-color: #4db8ff;
    }

    .search-filters {
        background: linear-gradient(135deg, #2d2d2d, #3a3a3a);
    }

    .filter-group input,
    .filter-group select {
        background: #2d2d2d;
        border-color: #555;
        color: #e0e0e0;
    }

    .results-header {
        background: linear-gradient(135deg, #3a3a3a, #2d2d2d);
    }

    .results-count {
        color: #f0f0f0;
    }

    #pagination-controls {
        background: linear-gradient(135deg, #2d2d2d, #3a3a3a);
        border-color: #555;
    }

    .pagination-info {
        color: #c0c0c0;
    }

    .pagination-btn {
        background: linear-gradient(135deg, #3a3a3a, #2d2d2d);
        border-color: #555;
        color: #e0e0e0;
    }

    .pagination-btn:hover {
        background: linear-gradient(135deg, #4a4a4a, #3a3a3a);
        border-color: #666;
    }
}

/* Accessibility Improvements */
.pagination-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.search-button:focus,
.export-btn:focus,
.expand-btn:focus,
.source-link:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

#ai-search-query:focus,
.filter-group input:focus,
.filter-group select:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Screen Reader Support */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .result-card {
        border: 2px solid #000;
    }

    .search-button {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }

    .pagination-btn.active {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }

    .result-type {
        background: #000;
        color: #fff;
    }
}

/* Print Styles */
@media print {
    .ai-search-form,
    .results-header,
    #pagination-controls,
    .result-actions {
        display: none;
    }

    .result-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .result-card::before {
        display: none;
    }

    .ai-research-wrapper {
        max-width: none;
        padding: 0;
    }

    .result-title a {
        color: #000;
        text-decoration: underline;
    }

    .result-summary {
        color: #333;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

/* Status Indicators */
.status-online {
    color: #28a745;
}

.status-offline {
    color: #dc3545;
}

.status-pending {
    color: #ffc107;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.badge-primary {
    color: #fff;
    background-color: #3498db;
}

.badge-success {
    color: #fff;
    background-color: #28a745;
}

.badge-warning {
    color: #212529;
    background-color: #ffc107;
}

.badge-danger {
    color: #fff;
    background-color: #dc3545;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.text-muted {
    color: #6c757d;
}

.text-primary {
    color: #3498db;
}

.text-success {
    color: #28a745;
}

.text-warning {
    color: #ffc107;
}

.text-danger {
    color: #dc3545;
}