:root {
        --primary: #272728;
        --primary-dark: #1a1a1a;
        --primary-light: #3a3a3a;
        --secondary: #10b981;
        --accent: #f59e0b;
        --danger: #ef4444;
        --success: #10b981;
        --warning: #f59e0b;
        --info: #3b82f6;
        --light-bg: #f9fafb;
        --card-bg: #ffffff;
        --border: #e5e7eb;
        --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
        --radius: 16px;
        --radius-sm: 10px;
        --radius-xs: 6px;
        --transition: all 0.3s ease;
    }

    .search-results {
        
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        padding: 30px;
        margin-bottom: 30px;
        animation: fadeIn 0.5s ease;
    }

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

    .search-header {
        border-bottom: 2px solid var(--border);
        padding-bottom: 20px;
        margin-bottom: 30px;
    }

    .search-header h1 {
        
        font-size: 1.8em;
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .search-header h1 i {
        color: var(--secondary);
    }

    .source-info {
        background: linear-gradient(135deg, #eef2ff, #e0e7ff);
        padding: 12px 20px;
        border-radius: var(--radius-xs);
        color: var(--info);
        font-weight: 500;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        border-right: 4px solid var(--info);
    }

    .source-info i {
        font-size: 1.2em;
    }

    .response-container {
        
        padding: 25px;
        border-radius: var(--radius);
        border: 1px solid var(--border);
        margin-bottom: 30px;
        line-height: 1.8;
        font-size: 1.1em;
    }

    .ai-results-container {
        background: linear-gradient(135deg, #ffffff, #f8fafc);
        border-radius: var(--radius);
        border: 2px solid var(--border);
        overflow: hidden;
        margin-top: 30px;
    }

    .ai-results-header {
        background: linear-gradient(135deg, var(--primary), var(--primary-dark));
        color: white;
        padding: 20px 30px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .ai-results-header h3 {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 1.3em;
    }

    .ai-stats {
        display: flex;
        gap: 20px;
        font-size: 0.9em;
    }

    .ai-stats span {
        background: rgba(255, 255, 255, 0.2);
        padding: 5px 12px;
        border-radius: 20px;
        font-weight: 600;
    }

    .ai-results-content {
        padding: 30px;
        max-height: 600px;
        overflow-y: auto;
    }

    .loading-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 30px;
        text-align: center;
    }

    .spinner {
        display: flex;
        gap: 8px;
        margin-bottom: 20px;
    }

    .spinner .dot1,
    .spinner .dot2,
    .spinner .dot3 {
        width: 12px;
        height: 12px;
        background: var(--secondary);
        border-radius: 50%;
        animation: bounce 1.4s infinite ease-in-out both;
    }

    .spinner .dot1 { animation-delay: -0.32s; }
    .spinner .dot2 { animation-delay: -0.16s; }

    @keyframes bounce {
        0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
        40% { transform: scale(1); opacity: 1; }
    }

    .chat-section {
        
        border-radius: var(--radius);
        overflow: hidden;
    }

    .chat-container {
        border-radius: var(--radius);
        overflow: hidden;
    }

    .chat-header {
        background: linear-gradient(135deg, var(--primary), var(--primary-dark));
        color: white;
        padding: 25px 30px;
        display: flex;
        align-items: center;
        gap: 20px;
        flex-wrap: wrap;
    }

    .chat-header-icon {
        background: linear-gradient(135deg, #ffd700, #ffea80);
        width: 60px;
        height: 60px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        
        flex-shrink: 0;
    }

    .chat-header-text {
        flex: 1;
        min-width: 300px;
    }

    .chat-header-text h2 {
        font-size: 1.6em;
        font-weight: 700;
        margin-bottom: 8px;
    }

    .chat-header-text p {
        font-size: 1em;
        opacity: 0.9;
        color: #ffd700;
    }

    .chat-status {
        background: rgba(255, 215, 0, 0.15);
        border: 1px solid rgba(255, 215, 0, 0.3);
        padding: 10px 18px;
        border-radius: 25px;
        font-size: 0.9em;
        display: flex;
        align-items: center;
        gap: 10px;
        white-space: nowrap;
    }

    .chat-status i {
        color: var(--success);
        font-size: 0.8em;
    }

    .chat-messages {
        height: 580px;
        overflow-y: auto;
        padding: 25px;
        
        display: flex;
        flex-direction: column;
        gap: 20px;
    }


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

    .message.question {
        background: linear-gradient(135deg, var(--accent), #f59e0b);
        color: white;
        align-self: flex-end;
        border-bottom-right-radius: 5px;
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
    }

    .message.answer {
        
        align-self: flex-start;
        border: 1px solid var(--border);
        border-bottom-left-radius: 5px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    }

    .message.question::before {
        content: '';
        position: absolute;
        right: -8px;
        top: 20px;
        width: 0;
        height: 0;
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        border-left: 8px solid #f59e0b;
    }

    .message.answer::before {
        content: '';
        position: absolute;
        left: -8px;
        top: 20px;
        width: 0;
        height: 0;
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        border-right: 8px solid var(--border);
    }

    .message-time {
        font-size: 12px;
        opacity: 0.7;
        margin-top: 8px;
        display: block;
        text-align: left;
    }

    .message.question .message-time {
        text-align: right;
        color: rgba(255, 255, 255, 0.8);
    }

    .chat-input-area {
        padding: 25px;
        
        border-top: 1px solid var(--border);
    }

    .input-wrapper {
        display: flex;
        gap: 15px;
        align-items: flex-end;
        margin-bottom: 20px;
    }

.chat-textarea {
    flex: 1;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Noto Sans Arabic', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    resize: none;
    min-height: 120px;
    max-height: 200px;
    transition: var(--transition);
    width: 100%;
}

    .chat-textarea:focus {
        outline: none;
        border-
        box-shadow: 0 0 0 3px rgba(39, 39, 40, 0.1);
    }

    .chat-textarea::placeholder {
        
    }

    .chat-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
        min-width: 140px;
    }

    .provider-select {
        padding: 12px 15px;
        border: 1px solid var(--border);
        border-radius: var(--radius-xs);
        
        font-family: 'Noto Sans Arabic', sans-serif;
        font-size: 14px;
        width: 100%;
        
    }

    .provider-select:focus {
        outline: none;
        border-
    }

    .chat-tools {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .tool-button {
        padding: 12px 18px;
        
        border: 1px solid var(--border);
        border-radius: var(--radius-xs);
        font-size: 14px;
        cursor: pointer;
        transition: var(--transition);
        display: flex;
        align-items: center;
        gap: 8px;
        
    }

    .tool-button:hover {
        background: var(--border);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .typing-indicator {
        display: none;
        align-items: center;
        gap: 10px;
        padding: 15px 25px;
        
        border-radius: 25px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        margin: 10px 25px;
        align-self: flex-start;
        border: 1px solid var(--border);
    }

    .typing-indicator span {
        width: 8px;
        height: 8px;
        background: var(--primary);
        border-radius: 50%;
        animation: typing 1.4s infinite ease-in-out both;
    }

    .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
    .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

    @keyframes typing {
        0%, 80%, 100% { transform: scale(0); }
        40% { transform: scale(1); }
    }

    .typing-indicator span:last-child {
        animation: none;
        width: auto;
        height: auto;
        background: transparent;
        
        font-size: 14px;
        margin-right: 10px;
    }



    @media (max-width: 768px) {
        .container {
            padding: 15px;
        }

        .main-container {
            margin-top: 10px;
        }

        .search-results,
        .chat-section {
            padding: 0px;
        }

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

        .chat-header-text {
            min-width: auto;
            text-align: center;
        }

        .chat-header-text h2 {
            font-size: 1.3em;
        }

        .chat-messages {
            height: 400px;
            padding: 15px;
        }

        .message {
            max-width: 90%;
            padding: 15px 18px;
            font-size: 15px;
        }

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

        .chat-buttons {
            flex-direction: row;
            width: 100%;
            min-width: auto;
        }

        .send-button,
        .provider-select {
            flex: 1;
            padding: 14px;
        }

        .chat-textarea {
            min-height: 100px;
            font-size: 15px;
        }

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

        .ai-stats {
            justify-content: center;
        }

        .chat-tools {
            justify-content: center;
        }

        .tool-button span {
            display: none;
        }

        .tool-button {
            padding: 12px;
            border-radius: 50%;
            width: 44px;
            height: 44px;
            justify-content: center;
        }

        .info-box {
            margin: 20px 15px;
            padding: 20px;
        }
    }

    @media (max-width: 480px) {
        .chat-messages {
            height: 350px;
        }

        .message {
            max-width: 95%;
            padding: 12px 15px;
            font-size: 14px;
        }

        .search-header h1 {
            font-size: 1.4em;
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
        }

        .ai-stats {
            flex-direction: column;
            gap: 10px;
        }

        .notification {
            min-width: auto;
            width: 95%;
            padding: 12px 18px;
            font-size: 14px;
        }
    }

    .message-content {
        line-height: 1.8;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
	
	

    .message-content h1,
    .message-content h2,
    .message-content h3 {
        
        margin: 20px 0 12px 0;
        font-weight: 600;
        line-height: 1.3;
    }

    .message-content h1 { font-size: 1.4em; border-bottom: 2px solid currentColor; padding-bottom: 8px; }
    .message-content h2 { font-size: 1.2em; border-bottom: 1px solid currentColor; padding-bottom: 6px; }
    .message-content h3 { font-size: 1.1em; }

    .message-content ul,
    .message-content ol {
        margin: 12px 0 12px 25px;
        padding-right: 15px;
    }


    .message-content code:not(pre code) {
        background: rgba(0, 0, 0, 0.08);
        padding: 2px 6px;
        border-radius: 4px;
        font-family: 'Courier New', monospace;
        font-size: 0.9em;
        color: #dc2626;
    }

    .message-content pre {
        background: #1f2937;
        color: #f9fafb;
        padding: 18px;
        border-radius: 8px;
        overflow-x: auto;
        margin: 15px 0;
        border: 1px solid #374151;
        font-size: 14px;
        line-height: 1.5;
    }

    .message-content pre code {
        background: transparent;
        
        padding: 0;
    }

    .message-content blockquote {
        border-right: 4px solid var(--accent);
        padding: 15px 20px;
        margin: 15px 0;
        background: rgba(245, 158, 11, 0.05);
        border-radius: 0 8px 8px 0;
        font-style: italic;
        color: #92400e;
    }

    .message-content table {
        width: 100%;
        border-collapse: collapse;
        margin: 15px 0;
        border: 1px solid var(--border);
        
    }

    .message-content th {
        
        font-weight: 600;
        padding: 12px 15px;
        border: 1px solid var(--border);
        text-align: right;
    }

    .message-content td {
        padding: 10px 15px;
        border: 1px solid var(--border);
    }

    .message-content tr:nth-child(even) {
        
    }

    body.dark-mode .message-content code:not(pre code) {
        background: rgba(255, 255, 255, 0.1);
        color: #fbbf24;
    }

    body.dark-mode .message-content blockquote {
        background: rgba(245, 158, 11, 0.1);
        color: #fde68a;
    }

    body.dark-mode .message-content table {
        border-color: #4b5563;
        background: #2d2d2d;
    }

    body.dark-mode .message-content th {
        background: #374151;
        border-color: #4b5563;
    }

    body.dark-mode .message-content td {
        border-color: #4b5563;
    }

    body.dark-mode .message-content tr:nth-child(even) {
        background: #374151;
    }

    .status-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
        margin: 0 5px;
    }

    .status-badge.online {
        background: rgba(16, 185, 129, 0.1);
        color: var(--success);
        border: 1px solid rgba(16, 185, 129, 0.3);
    }

    .status-badge.offline {
        background: rgba(239, 68, 68, 0.1);
        color: var(--danger);
        border: 1px solid rgba(239, 68, 68, 0.3);
    }

    .status-badge.loading {
        background: rgba(245, 158, 11, 0.1);
        color: var(--warning);
        border: 1px solid rgba(245, 158, 11, 0.3);
    }

    @keyframes pulse {
        0% { transform: scale(1); }
        50% { transform: scale(1.05); }
        100% { transform: scale(1); }
    }

    .pulse {
        animation: pulse 2s infinite;
    }

    @keyframes slideInRight {
        from { transform: translateX(30px); opacity: 0; }
        to { transform: translateX(0); opacity: 1; }
    }

    .slide-in-right {
        animation: slideInRight 0.5s ease;
    }

    @keyframes slideInLeft {
        from { transform: translateX(-30px); opacity: 0; }
        to { transform: translateX(0); opacity: 1; }
    }

    .slide-in-left {
        animation: slideInLeft 0.5s ease;
    }

    .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;
    }

    :focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

    .will-change-transform {
        will-change: transform;
    }

    .will-change-opacity {
        will-change: opacity;
    }

    @media print {
        .chat-input-area,
        .chat-tools,
        .typing-indicator,
        .notification,
        .info-box {
            display: none !important;
        }

        .chat-messages {
            height: auto;
            overflow: visible;
        }

        .message {
            max-width: 100%;
            break-inside: avoid;
        }
    }