/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Helvetica', sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
    height: 100vh;
    overflow: hidden;
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 50%, #000000 100%);
    color: #ffffff;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    border-bottom: 3px solid #0066cc;
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(196, 30, 58, 0.3);
}

.chatbot-info h1 {
    font-size: 24px;
    margin-bottom: 5px;
    color: #ffffff;
    font-weight: 300;
    letter-spacing: 1px;
}

.chatbot-info p {
    opacity: 0.8;
    font-size: 14px;
    color: #cccccc;
    font-weight: 300;
}

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

/* Chat Area */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    scroll-behavior: smooth;
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 15px;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.bot {
    align-self: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    color: white;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, #666666 0%, #333333 100%);
    color: white;
}

.message-content {
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    word-wrap: break-word;
    line-height: 1.5;
}

/* Message formatting styles */
.message-content strong {
    font-weight: 700;
    color: #ffffff;
}

.message-content em {
    font-style: italic;
    color: #0066cc;
}

.message-content code {
    font-weight: 700;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: inherit;
}

.message-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 5px 0;
}

.message-content h4, .message-content h5 {
    margin: 15px 0 10px 0;
    color: #0066cc;
}

.message-content a {
    color: #0066cc;
    text-decoration: none;
    border-bottom: 1px solid #0066cc;
}

.message-content a:hover {
    color: #004499;
    border-bottom-color: #004499;
}

/* Message Buttons */
.message-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.message-button {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: #ffffff;
    border: 2px solid #0066cc;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-width: 120px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.message-button:hover {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    color: white;
    border-color: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
}

.message-button:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .message-buttons {
        flex-direction: column;
    }
    
    .message-button {
        width: 100%;
    }
}

.message.user .message-content {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    color: white;
    border: 1px solid #0052a3;
}

.message.bot .message-content {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: #ffffff;
    border: 1px solid #0066cc;
}

.message-time {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 5px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    align-self: flex-start;
    max-width: 200px;
    color: #ffffff;
}

.typing-dots {
    display: flex;
    gap: 5px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #2563eb;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

.typing-text {
    font-size: 14px;
    color: #ffffff;
}

/* Input Area */
.input-area {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

.input-container {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

#message-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 15px 20px;
    font-size: 16px;
    resize: none;
    outline: none;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

#message-input:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.char-count {
    font-size: 12px;
    color: #666;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    color: white;
    border: 1px solid #0052a3;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #004499 0%, #0066cc 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

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

.btn-link {
    background: none;
    color: #2563eb;
    padding: 8px 16px;
}

.btn-link:hover {
    background: rgba(3, 135, 135, 0.1);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #2d2d2d;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 50%, #000000 100%);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #0066cc;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

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

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

.modal-body {
    padding: 20px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Settings */
.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.setting-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* History */
.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #0066cc;
    box-shadow: 0 2px 8px rgba(196, 30, 58, 0.1);
}

.history-item h4 {
    margin-bottom: 5px;
    color: #333;
}

.history-item p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Feedback */
.feedback-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feedback-item label {
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

.feedback-text {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1001;
    display: none;
    animation: slideInRight 0.3s ease;
}

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

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #333;
}

.notification.info {
    background: #17a2b8;
    color: white;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    margin-left: 15px;
    cursor: pointer;
    font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        margin: 0;
        border-radius: 0;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .message {
        max-width: 90%;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Dark theme */
[data-theme="dark"] {
    background: #1a1a1a;
}

[data-theme="dark"] .chat-container {
    background: #2d2d2d;
    color: white;
}

[data-theme="dark"] .chat-area {
    background: #1a1a1a;
}

[data-theme="dark"] .message-content {
    background: #3d3d3d;
    color: white;
}

[data-theme="dark"] .input-area {
    background: #2d2d2d;
    border-top-color: #3d3d3d;
}

[data-theme="dark"] #message-input {
    background: #3d3d3d;
    color: white;
    border-color: #4d4d4d;
}

[data-theme="dark"] .modal-content {
    background: #2d2d2d;
    color: white;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
    background: #3d3d3d;
    color: white;
    border-color: #4d4d4d;
}

/* Font sizes */
[data-font-size="small"] {
    font-size: 14px;
}

[data-font-size="medium"] {
    font-size: 16px;
}

[data-font-size="large"] {
    font-size: 18px;
}

/* Light theme */
[data-theme="light"] {
    background: #ffffff;
}

[data-theme="light"] .chat-container {
    background: #ffffff;
    color: #2d3748;
}

[data-theme="light"] .chat-area {
    background: #f7fafc;
}

[data-theme="light"] .message-content {
    background: #ffffff;
    color: #2d3748;
}

[data-theme="light"] .input-area {
    background: #ffffff;
    border-top-color: #e2e8f0;
}

[data-theme="light"] #message-input {
    background: #f7fafc;
    color: #2d3748;
    border-color: #e2e8f0;
}

[data-theme="light"] .modal-content {
    background: #ffffff;
    color: #2d3748;
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea {
    background: #f7fafc;
    color: #2d3748;
    border-color: #e2e8f0;
}

/* Default theme (current styles) */
[data-theme="default"] {
    background: #2563eb;
}

[data-theme="default"] .chat-container {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
}

[data-theme="default"] .chat-area {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
}

[data-theme="default"] .message-content {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: #ffffff;
}

[data-theme="default"] .input-area {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-top-color: #0066cc;
}

[data-theme="default"] #message-input {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: #333;
    border-color: #e9ecef;
}

[data-theme="default"] .modal-content {
    background: white;
    color: #333;
}

[data-theme="default"] .form-group input,
[data-theme="default"] .form-group select,
[data-theme="default"] .form-group textarea {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: #333;
    border-color: #e9ecef;
}

/* Footer Styles */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer p {
    margin: 0;
}

/* Web Search Styles */
.web-search-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    margin: 10px 0;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.web-search-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.web-search-icon {
    font-size: 20px;
    animation: pulse 2s infinite;
}

.web-search-text {
    font-weight: 600;
    font-size: 14px;
}

.web-search-tip {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.4;
}

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

/* Web search results styling */
.web-search-results {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

.web-search-result {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}

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

.web-search-result-title {
    font-weight: 600;
    color: #1a73e8;
    margin-bottom: 5px;
    font-size: 14px;
}

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

.web-search-result-snippet {
    color: #3c4043;
    font-size: 13px;
    line-height: 1.4;
}

/* Web search status indicators */
.web-search-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    margin: 5px 0;
    font-size: 12px;
    color: #1976d2;
}

.web-search-status.searching {
    background: #fff3e0;
    border-color: #ffcc02;
    color: #f57c00;
}

.web-search-status.success {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #2e7d32;
}

.web-search-status.error {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}