/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Layout */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.main-header {
    padding: 30px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.company-logo {
    width: 120px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px 0;
}

.chat-wrapper {
    display: flex;
    justify-content: center;
}

.chat-panel {
    width: 100%;
    max-width: 800px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    background: #f8f9fa;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
}

.chat-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.chat-header p {
    font-size: 14px;
    color: #6c757d;
    margin: 0;
}

/* Chat Messages Area */
.chat-messages-area {
    height: 500px;
    overflow-y: auto;
    padding: 20px 25px;
    background: #fff;
}

.welcome-message {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    background: #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.message-bubble {
    max-width: 70%;
    padding: 15px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.bot-bubble {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #333;
}

.user-bubble {
    background: #007bff;
    color: white;
    margin-left: auto;
}

.message-bubble p {
    margin: 0;
}

.message-bubble p + p {
    margin-top: 8px;
}

.message-bubble strong {
    font-weight: 600;
}

/* Message Layout */
.user-message {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-bottom: 15px;
}

.bot-message {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

/* Chat Input Area */
.chat-input-area {
    background: #f8f9fa;
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
}

.input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ced4da;
    border-radius: 25px;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s ease;
}

.message-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.send-btn:hover {
    background: #0056b3;
}

.send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Voice and Speaker Buttons */
.voice-btn, .speaker-btn {
    width: 45px;
    height: 45px;
    border: 2px solid #007bff;
    background: white;
    color: #007bff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.voice-btn:hover, .speaker-btn:hover {
    background: #007bff;
    color: white;
    transform: translateY(-1px);
}

.voice-btn.recording {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
    animation: pulse 1.5s infinite;
}

.speaker-btn.active {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.speaker-btn.muted {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.typing-bubble {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 15px 18px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #6c757d;
    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;
    }
}


/* Articles Container */
.articles-container {
    margin: 15px 0 15px 55px;
    padding: 0;
}

.articles-header {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-left: 3px solid #007bff;
    border-radius: 4px;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.article-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.article-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #f8f9fa;
}

.article-image-placeholder {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.article-content {
    padding: 12px;
    flex: 1;
}

.article-title {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-description {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Scrollbar Styling */
.chat-messages-area::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages-area::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages-area::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .main-header {
        padding: 20px 0;
    }
    
    .company-logo {
        width: 100px;
    }
    
    .main-content {
        padding: 20px 0;
    }
    
    .chat-panel {
        margin: 0 10px;
        border-radius: 0;
    }
    
    .chat-messages-area {
        height: 400px;
        padding: 15px 20px;
    }
    
    .chat-header {
        padding: 15px 20px;
    }
    
    .chat-input-area {
        padding: 15px 20px;
    }
    
    .message-bubble {
        max-width: 85%;
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .bot-avatar, .user-avatar {
        width: 35px;
        height: 35px;
    }
    
    .articles-container {
        margin-left: 0;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
}

@media (max-width: 480px) {
    .main-header {
        padding: 15px 0;
    }
    
    .company-logo {
        width: 80px;
    }
    
    .chat-messages-area {
        height: 350px;
    }
    
    .input-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .message-input {
        width: 100%;
    }
    
    .send-btn {
        width: 100%;
        justify-content: center;
    }
    
    .voice-btn, .speaker-btn {
        width: 40px;
        height: 40px;
    }
    
    .article-image,
    .article-image-placeholder {
        height: 100px;
    }
    
    .articles-header {
        font-size: 13px;
        padding: 6px 10px;
    }
}