:root {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7F7F8;
    --bg-tertiary: #ECECF1;
    --text-primary: #202123;
    --text-secondary: #8E8EA0;
    --border-color: #E5E5E5;
    --hover-bg: #E0E0E0;
    --input-bg: #F7F7F8;
}

[data-theme="dark"] {
    --bg-primary: #343541;
    --bg-secondary: #202123;
    --bg-tertiary: #2A2B32;
    --text-primary: #ECECF1;
    --text-secondary: #8E8EA0;
    --border-color: #4D4D4F;
    --hover-bg: #2A2B32;
    --input-bg: #40414F;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden;
    transition: background 0.3s, color 0.3s;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
}

#themeToggle {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    color: var(--text-primary);
}

#themeToggle:hover {
    background: var(--hover-bg);
}

.new-chat-btn {
    margin: 10px;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: background 0.2s;
}

.new-chat-btn:hover {
    background: var(--hover-bg);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

/* Welcome Screen */
.welcome-screen {
    text-align: center;
    padding: 40px 20px;
    margin-top: 100px;
}

.welcome-screen h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.welcome-screen p {
    color: #8E8EA0;
    font-size: 16px;
}

/* Example Questions */
.example-questions {
    margin-top: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.examples-title {
    color: #8E8EA0;
    font-size: 14px;
    margin-bottom: 15px;
}

.example-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    margin-bottom: 10px;
    background: #F7F7F8;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    color: #202123;
    font-size: 14px;
    cursor: pointer;
    text-align: right;
    transition: all 0.2s;
}

.example-btn:hover {
    background: #ECECF1;
    border-color: #D0D0D0;
}

/* Messages */
.message {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    position: relative;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    color: white;
}

.user-message .message-avatar {
    background: #5436DA;
}

.bot-message .message-avatar {
    background: #10A37F;
}

.message-content {
    flex: 1;
    padding-top: 5px;
    line-height: 1.6;
}

/* Copy Button */
.copy-btn {
    position: absolute;
    top: 8px;
    left: 10px;
    background: #F7F7F8;
    border: 1px solid #D0D0D0;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
    color: #202123;
}

.message:hover .copy-btn {
    opacity: 1;
    background: #ECECF1;
}

.copy-btn:hover {
    background: #E0E0E0;
    border-color: #B0B0B0;
}

/* Chat History */
.chat-item {
    padding: 10px;
    margin: 5px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chat-item:hover {
    background: #ECECF1;
}

.chat-item.active {
    background: #E0E0E0;
}

.chat-item-content {
    flex: 1;
}

.chat-title {
    font-size: 14px;
    color: #202123;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-date {
    font-size: 12px;
    color: #8E8EA0;
    margin-top: 4px;
}

.chat-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-item:hover .chat-actions {
    opacity: 1;
}

.share-chat-btn,
.delete-chat-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.share-chat-btn:hover {
    color: #10A37F;
}

.delete-chat-btn:hover {
    color: #c8102e;
}

/* Input Container */
.input-container {
    padding: 20px;
    background: var(--bg-primary);
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: flex-end;
    padding: 12px;
    gap: 10px;
}

#userInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    resize: none;
    outline: none;
    max-height: 200px;
    font-family: inherit;
}

#userInput::placeholder {
    color: var(--text-secondary);
}

/* Voice Button */
#voiceBtn {
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8E8EA0;
    transition: all 0.3s;
}

#voiceBtn:hover {
    background: #F7F7F8;
    color: #202123;
}

#voiceBtn.recording {
    background: #ff4444;
    color: white;
    animation: pulse 1.5s infinite;
}

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

#sendBtn {
    background: #19C37D;
    border: none;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.2s;
}

#sendBtn:hover {
    background: #1A7F5E;
}

#sendBtn:disabled {
    background: #4D4D4F;
    cursor: not-allowed;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    max-width: 300px;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #4D4D4F;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    body {
        height: 100dvh;
    }
    
    .sidebar {
        display: none;
    }
    
    .chat-container {
        padding: 15px;
        padding-bottom: 100px;
    }
    
    .input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        background: var(--bg-primary);
        z-index: 100;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .welcome-screen {
        margin-top: 40px;
        padding: 20px;
    }
    
    .welcome-screen h1 {
        font-size: 24px;
    }
}
/* ============================================
   Quick Calculate Modal Styles
   ============================================ */

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 30px 0;
    max-width: 700px;
}

.action-btn {
    padding: 15px 25px;
    background: linear-gradient(135deg, #2c5f2d 0%, #3a7d3f 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(44, 95, 45, 0.2);
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(44, 95, 45, 0.3);
    background: linear-gradient(135deg, #3a7d3f 0%, #2c5f2d 100%);
}

.quick-calculate-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    color: #2c5f2d;
    font-size: 24px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: #f5f5f5;
    color: #c8102e;
    transform: rotate(90deg);
}

.calculate-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.tab-btn.active {
    background: #2c5f2d;
    color: white;
    border-color: #2c5f2d;
}

.tab-btn:hover:not(.active) {
    background: #e8f5e9;
    border-color: #2c5f2d;
    color: #2c5f2d;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.form-group {
    margin-bottom: 20px;
}

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

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

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2c5f2d;
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

.weight-input {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
}

.calc-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #2c5f2d 0%, #3a7d3f 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(44, 95, 45, 0.3);
}

.calc-btn:active {
    transform: translateY(0);
}

.result-box {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border-radius: 15px;
    border-right: 5px solid #2c5f2d;
    display: none;
    animation: resultSlideIn 0.4s ease;
}

.result-box.show {
    display: block;
}

@keyframes resultSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-box h4 {
    color: #2c5f2d;
    margin: 0 0 15px 0;
    font-size: 20px;
}

.result-box .price {
    font-size: 36px;
    font-weight: 700;
    color: #2c5f2d;
    margin: 10px 0;
}

.result-box .details {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-top: 10px;
}

.result-box .group-info {
    background: white;
    padding: 12px;
    border-radius: 10px;
    margin-top: 15px;
    border-right: 3px solid #97ce4c;
}

.suggestions {
    position: absolute;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    max-height: 200px;
    overflow-y: auto;
    width: calc(100% - 30px);
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: none;
}

.suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #e8f5e9;
}

.service-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 20px;
    border-radius: 12px;
    margin: 15px 0;
    border-right: 4px solid #2c5f2d;
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateX(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.service-card h3 {
    margin: 0 0 10px 0;
    color: #2c5f2d;
    font-size: 18px;
}

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

/* Calculator button in input area */
#calcBtn {
    background: none;
    border: none;
    color: #2c5f2d;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

#calcBtn:hover {
    background: #e8f5e9;
}

/* Dark mode support */
body.dark-mode .modal-content {
    background: #1e1e1e;
    color: #e0e0e0;
}

body.dark-mode .form-group input,
body.dark-mode .form-group select {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #3a3a3a;
}

body.dark-mode .result-box {
    background: linear-gradient(135deg, #1a3a1a 0%, #2a4a2a 100%);
}

body.dark-mode .service-card {
    background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
}

body.dark-mode .suggestions {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

body.dark-mode .suggestion-item:hover {
    background: #1a3a1a;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .weight-input {
        grid-template-columns: 1.5fr 1fr;
    }
}

.thinking-dots {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 5px;
}

.thinking-dots .dot {
    width: 10px;
    height: 10px;
    background: #2c5f2d;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.thinking-dots .dot:nth-child(1) { animation-delay: 0s; }
.thinking-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    40% {
        transform: translateY(-12px);
        opacity: 0.7;
    }
}