/* Root Variables - Modern Chat Theme */
:root {
    --primary-color: #2F7A5F;  /* Calming forest green */
    --secondary-color: #3A8F6F;  /* Lighter green */
    --accent-color: #4CAF86;  /* Soft mint green */
    --success-color: #48BB78;
    --warning-color: #ECC94B;
    --danger-color: #F56565;
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --bg-primary: #F5F5F5;  /* Very light grey background for chat */
    --bg-secondary: #E8E8E8;  /* Slightly darker grey for input area */
    --bg-user: #E0E0E0;  /* Light grey for user messages */
    --bg-assistant: #2FB4B2;  /* Teal/turquoise for bot messages */
    --border-color: #D5E8E1;  /* Light green border */
    --shadow: 0 2px 8px rgba(47, 122, 95, 0.1);
    --shadow-hover: 0 4px 12px rgba(47, 122, 95, 0.15);
    --timestamp-color: #999999;  /* Light grey for timestamps */
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-primary);  /* Very light grey background */
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;  /* Smaller base font size */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

/* RTL Support for Arabic */
body[dir="rtl"] {
    direction: rtl;
}

.container {
    width: 100%;
    height: 100vh;
    background: var(--bg-primary);  /* Very light grey background */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Welcome Message */
.welcome-message {
    padding: 30px;
    text-align: center;
}

.welcome-content {
    max-width: 600px;
    margin: 0 auto;
}

.welcome-content h2 {
    color: var(--primary-color);
    margin-bottom: 16px;
    font-size: 24px;
}

.welcome-content p {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}

.welcome-content ul {
    text-align: left;
    margin: 20px auto;
    max-width: 500px;
    list-style: none;
}

.welcome-content li {
    padding: 10px 0;
    font-size: 15px;
}

.privacy-note {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 20px;
    font-style: italic;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #FFFFFF;
    scroll-behavior: smooth;
    position: relative;
    display: flex;
    flex-direction: column;
}

.chat-spacer {
    flex: 1;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Timestamp styling */
.message-timestamp {
    text-align: center;
    color: var(--timestamp-color);
    font-size: 12px;
    margin: 12px 0;
    padding: 0;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

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

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

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
    background: #E0E0E0;  /* Light grey background for avatars */
}

.message.user .message-avatar {
    background: #E0E0E0;  /* Light grey for user avatar */
    color: #666;
}

.message.assistant .message-avatar {
    background: #ffffff;
    padding: 2px;
}

.message.assistant .message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.message-content {
    padding: 12px 16px;  /* Slightly smaller padding */
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;  /* Smaller message text */
    word-wrap: break-word;
    max-width: 100%;
}

.message.user .message-content {
    background: var(--bg-user);  /* Light grey for user messages */
    border-bottom-right-radius: 4px;
    border-top-right-radius: 16px;
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
    color: #000000;  /* Black text */
}

.message.user .message-text {
    color: #000000;  /* Black text */
}

.message.user .message-time {
    color: rgba(0, 0, 0, 0.6);
}

.message.assistant .message-content {
    background: var(--bg-assistant);  /* Teal/turquoise for bot messages */
    border-bottom-left-radius: 4px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    color: #FFFFFF;  /* White text */
}

.message.assistant .message-text {
    color: #FFFFFF;  /* White text */
}

.message.assistant .message-time {
    color: rgba(255, 255, 255, 0.9);
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    opacity: 0.7;
}

/* Markdown Content Styling */
.message-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-text p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text strong,
.message-text b {
    font-weight: 700;
    color: var(--text-primary);
}

.message-text em,
.message-text i {
    font-style: italic;
}

.message-text ul,
.message-text ol {
    margin: 8px 0 12px 0;
    padding-left: 24px;
}

.message-text ul {
    list-style-type: disc;
}

.message-text ol {
    list-style-type: decimal;
}

.message-text li {
    margin: 6px 0;
    line-height: 1.6;
}

.message-text li > p {
    margin: 0;
}

.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.4;
}

.message-text h1 { font-size: 1.3em; }  /* Smaller headings */
.message-text h2 { font-size: 1.15em; }
.message-text h3 { font-size: 1.05em; }
.message-text h4 { font-size: 1em; }
.message-text h5 { font-size: 0.95em; }
.message-text h6 { font-size: 0.9em; }

.message-text h1:first-child,
.message-text h2:first-child,
.message-text h3:first-child {
    margin-top: 0;
}

.message-text code {
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-text pre {
    padding: 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-text pre code {
    padding: 0;
    background: none;
}

.message-text blockquote {
    margin: 8px 0;
    padding-left: 12px;
    border-left: 3px solid var(--primary-color);
    color: var(--text-secondary);
    font-style: italic;
}

.message-text a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid var(--primary-color);
}

.message-text a:hover {
    opacity: 0.8;
}

.message-text hr {
    margin: 16px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 14px 18px;
    background: var(--bg-assistant);  /* Teal/turquoise to match bot messages */
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-left: 52px;
}

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

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

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Specialists Panel */
.specialists-panel {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.specialists-panel h3 {
    color: var(--primary-color);
    margin-bottom: 16px;
}

.specialist-card {
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.specialist-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.specialist-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.specialist-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Input Container */
.input-container {
    padding: 20px 30px;
    background: #FFFFFF;  /* White background for input container */
    border-top: none;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    position: relative;
}

#messageInput {
    flex: 1;
    padding: 12px 50px 12px 16px;  /* Extra padding on right for send icon */
    border: none;
    border-radius: 24px;
    font-size: 14px;  /* Smaller input text */
    font-family: inherit;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    max-height: 120px;
    background: #F7F7F7;  /* Very light grey background - rgb(247, 247, 247) */
    color: var(--text-primary);
}

#messageInput::placeholder {
    color: #666666;  /* Medium-dark grey placeholder text - rgb(102, 102, 102) */
}

#messageInput:focus {
    outline: none;
}

.send-button {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #CCCCCC;  /* Light grey send icon - rgb(204, 204, 204) */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    z-index: 10;
    pointer-events: auto;
}

.send-button:hover:not(:disabled) {
    color: #999999;  /* Slightly darker grey on hover */
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Suggested Actions */
.suggested-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.action-chip {
    padding: 8px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Footer removed */

/* Crisis Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 16px;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: var(--danger-color);
    margin-bottom: 20px;
}

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

.modal-content li {
    margin: 12px 0;
}

.modal-button {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-button:hover {
    background: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .logo h1 {
        font-size: 24px;
    }

    .message {
        max-width: 90%;
    }

    .input-container {
        padding: 16px 20px;
    }
}

/* Scrollbar Styling */
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ============================================
   ROLE SELECTION MENU & AUTHENTICATION
   ============================================ */

/* Role Selection Menu - REMOVED (unused in current version) */

/* Login Modal & Form Styles - REMOVED (unused in current version) */

/* Agent Actions (buttons container) */
.agent-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Role Switch Button */
.role-switch-button {
    background: var(--accent-color);
    border: 1px solid var(--accent-color);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.role-switch-button:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Logout Button */
.logout-button {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-button:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Button Spinner */
.button-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 600px) {
    .role-buttons {
        grid-template-columns: 1fr;
    }

    .role-menu-content {
        padding: 24px;
    }

    .login-modal {
        padding: 28px;
    }
}

/* Mobile App Download Section - REMOVED (unused in current version) */
