/* Tombit Chatbot Frontend Styles */

/* Base chatbot container */
#tombit-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-width: 90vw;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* Header */
.tombit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tombit-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.tombit-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.tombit-toggle:hover {
    transform: scale(1.1);
}

/* Chat container */
.tombit-chat-container {
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

/* Messages */
.tombit-messages {
    height: 300px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tombit-message {
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
}

.tombit-message.user {
    align-self: flex-end;
    margin-left: auto;
}

.tombit-message.bot {
    align-self: flex-start;
    margin-right: auto;
}

/* Input container */
.tombit-input-container {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    border-top: 1px solid;
}

.tombit-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.tombit-send {
    padding: 10px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.tombit-send:hover {
    transform: translateY(-1px);
}

.tombit-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading indicator */
.tombit-loading {
    text-align: center;
    padding: 12px;
    font-style: italic;
    opacity: 0.7;
}

/* Style themes */

/* Light theme */
.tombit-style-light, .tombit-style-none {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e1e5e9;
    --accent-color: #007cba;
    --user-bg: #007cba;
    --user-text: #ffffff;
    --bot-bg: #f1f3f4;
    --bot-text: #333333;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Dark theme */
.tombit-style-dark {
    --bg-primary: #2d3748;
    --bg-secondary: #1a202c;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --border-color: #4a5568;
    --accent-color: #63b3ed;
    --user-bg: #63b3ed;
    --user-text: #1a202c;
    --bot-bg: #4a5568;
    --bot-text: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Gray theme */
.tombit-style-gray {
    --bg-primary: #f7f8fc;
    --bg-secondary: #e2e8f0;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --border-color: #cbd5e0;
    --accent-color: #4a5568;
    --user-bg: #4a5568;
    --user-text: #ffffff;
    --bot-bg: #e2e8f0;
    --bot-text: #2d3748;
    box-shadow: 0 8px 32px rgba(45, 55, 72, 0.15);
}

/* Midnight theme */
.tombit-style-midnight {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --accent-color: #06b6d4;
    --user-bg: #06b6d4;
    --user-text: #0f172a;
    --bot-bg: #334155;
    --bot-text: #f1f5f9;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.8);
}

/* Apply theme variables */
#tombit-chatbot {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.tombit-header {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.tombit-toggle {
    color: var(--text-primary);
}

.tombit-toggle:hover {
    background: var(--border-color);
}

.tombit-chat-container {
    background: var(--bg-primary);
}

.tombit-messages {
    background: var(--bg-primary);
}

.tombit-message.user {
    background: var(--user-bg);
    color: var(--user-text);
}

.tombit-message.bot {
    background: var(--bot-bg);
    color: var(--bot-text);
}

.tombit-input-container {
    border-color: var(--border-color);
    background: var(--bg-primary);
}

.tombit-input {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.tombit-input:focus {
    border-color: var(--accent-color);
}

.tombit-send {
    background: var(--accent-color);
    color: var(--user-text);
}

.tombit-loading {
    color: var(--text-secondary);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #tombit-chatbot {
        bottom: 10px;
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .tombit-chat-container {
        max-height: 50vh;
    }
    
    .tombit-messages {
        height: calc(50vh - 120px);
    }
}