/* Seargio Chat Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Header */
.chat-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.chat-header h1 {
    font-size: 32px;
    margin: 0 0 8px 0;
    font-weight: 400;
}

.logo-s { color: #4285f4; }
.logo-e { color: #ea4335; }
.logo-a { color: #fbbc04; }
.logo-r { color: #4285f4; }
.logo-g { color: #34a853; }
.logo-i { color: #ea4335; }
.logo-o { color: #fbbc04; }

.chat-title {
    color: white;
    font-weight: 500;
}

.chat-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0 0 12px 0;
}

.header-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.chat-welcome {
    text-align: center;
    padding: 60px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.chat-welcome h2 {
    font-size: 28px;
    color: #202124;
    margin-bottom: 16px;
}

.chat-welcome p {
    color: #5f6368;
    font-size: 16px;
    margin-bottom: 32px;
}

.example-questions {
    display: grid;
    gap: 12px;
}

.example-btn {
    padding: 16px 20px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 12px;
    color: #202124;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.example-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

/* Message Bubbles */
.message {
    margin-bottom: 24px;
    display: flex;
    animation: messageSlide 0.3s ease-out;
}

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

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 75%;
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: white;
    color: #202124;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.message-role {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.message.user .message-role {
    color: rgba(255, 255, 255, 0.9);
}

.message.assistant .message-role {
    color: #5f6368;
}

.message-text {
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.cursor {
    animation: blink 1s infinite;
    margin-left: 2px;
    font-weight: bold;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Sources */
.message-sources {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.message.user .message-sources {
    border-top-color: rgba(255, 255, 255, 0.3);
}

.sources-title {
    font-size: 13px;
    font-weight: 600;
    color: #5f6368;
    margin-bottom: 8px;
}

.message.user .sources-title {
    color: rgba(255, 255, 255, 0.9);
}

.sources-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.source-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    color: #1a73e8;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.message.user .source-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.source-link:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateX(4px);
}

.message.user .source-link:hover {
    background: rgba(255, 255, 255, 0.3);
}

.source-domain {
    margin-left: auto;
    color: #5f6368;
    font-size: 12px;
}

.message.user .source-domain {
    color: rgba(255, 255, 255, 0.8);
}

/* Loading Animation */
.loading-message {
    display: flex;
    gap: 6px;
    padding: 8px 0;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: loadingBounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Input Area */
.chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    position: sticky;
    bottom: 0;
}

.chat-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #dadce0;
    border-radius: 24px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    min-height: 44px;
    transition: all 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

.chat-submit {
    width: 48px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-submit:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-submit:disabled {
    background: #dadce0;
    cursor: not-allowed;
    transform: none;
}

.chat-info {
    text-align: center;
    color: #5f6368;
    font-size: 12px;
    margin-top: 8px;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: #5f6368;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #34a853;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.error {
    background: #ea4335;
}

.status-dot.loading {
    background: #fbbc04;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Error Message */
.error-message {
    padding: 16px;
    background: #fce8e6;
    color: #c5221f;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid #ea4335;
    animation: messageSlide 0.3s ease-out;
}

/* History Sidebar */
.history-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease-out;
    z-index: 1000;
}

.history-sidebar.active {
    right: 0;
}

.history-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.history-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.history-list {
    padding: 20px;
    overflow-y: auto;
    height: calc(100vh - 80px);
}

.history-empty {
    text-align: center;
    color: #5f6368;
    padding: 40px 20px;
}

.history-item {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.history-item:hover {
    background: #e8f0fe;
    border-color: #667eea;
}

.history-item-title {
    font-weight: 500;
    margin-bottom: 4px;
    color: #202124;
}

.history-item-date {
    font-size: 12px;
    color: #5f6368;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        max-width: 100%;
        box-shadow: none;
    }

    .chat-header h1 {
        font-size: 24px;
    }

    .message-content {
        max-width: 85%;
    }

    .history-sidebar {
        width: 100%;
        right: -100%;
    }

    .example-questions {
        grid-template-columns: 1fr;
    }
}

/* Search Results Display */
.search-results-container {
    margin-top: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e0e0e0;
}

.search-results-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
}

.search-results-icon {
    font-size: 20px;
}

.search-results-title {
    font-size: 15px;
    font-weight: 600;
    color: #202124;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-result-card {
    background: white;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.search-result-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
    transform: translateY(-1px);
}

.search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.search-result-title {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: #1a0dab;
    text-decoration: none;
    line-height: 1.4;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.search-result-title:hover {
    text-decoration: underline;
}

.search-result-number {
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
}

.search-result-score {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.search-result-url {
    color: #5f6368;
    font-size: 13px;
    margin-bottom: 6px;
    word-break: break-all;
}

.search-result-description {
    color: #3c4043;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-description em {
    background: #fff3cd;
    font-style: normal;
    font-weight: 500;
}

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

.search-result-link {
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.search-result-link:hover {
    color: #764ba2;
    gap: 8px;
}

/* Mobile responsiveness for search results */
@media (max-width: 768px) {
    .search-results-container {
        padding: 12px;
    }

    .search-result-card {
        padding: 12px;
    }

    .search-result-title {
        font-size: 15px;
    }

    .search-result-score {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* Show More Button */
.show-more-container {
    display: flex;
    justify-content: center;
    padding: 20px 0 10px 0;
}

.show-more-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.show-more-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.show-more-btn:active:not(:disabled) {
    transform: translateY(0);
}

.show-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.show-more-icon {
    font-size: 16px;
    animation: bounce 2s infinite;
}

.show-more-btn .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-4px);
    }
    60% {
        transform: translateY(-2px);
    }
}

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

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

/* Footer Styles */
.chat-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.footer-links .separator {
    color: #ccc;
    font-size: 0.8em;
}

.footer-text {
    color: #666;
    font-size: 0.85em;
}

.footer-text p {
    margin: 0;
}

/* Adjust chat container to account for footer */
.chat-container {
    padding-bottom: 70px;
}

/* Mobile responsive footer */
@media (max-width: 768px) {
    .chat-footer {
        padding: 12px 15px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .footer-links {
        justify-content: center;
    }

    .footer-links a {
        font-size: 0.85em;
    }

    .footer-text {
        font-size: 0.8em;
    }
}
