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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

header p {
    opacity: 0.9;
    font-size: 16px;
}

.status-bar {
    background: #f8f9fa;
    padding: 10px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.status-indicator {
    font-size: 20px;
}

.server-info {
    margin-left: auto;
    color: #6c757d;
    font-family: monospace;
}

.chat-container {
    height: 500px;
    display: flex;
    flex-direction: column;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s;
}

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

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

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.message.user .avatar {
    background: #667eea;
    color: white;
}

.message.assistant .avatar {
    background: #764ba2;
    color: white;
}

.message.system .avatar {
    background: #6c757d;
    color: white;
}

.content {
    max-width: 70%;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message.user .content {
    background: #667eea;
    color: white;
}

.content p {
    margin: 5px 0;
    line-height: 1.5;
}

.content pre {
    background: #f1f3f5;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
    margin: 10px 0;
}

.message.user .content pre {
    background: rgba(255,255,255,0.2);
    color: white;
}

.input-area {
    display: flex;
    padding: 20px;
    gap: 10px;
    background: white;
    border-top: 1px solid #e9ecef;
}

textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

button {
    padding: 0 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

button:hover {
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.debug-panel {
    border-top: 2px solid #e9ecef;
    background: #f8f9fa;
}

.debug-panel h3 {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
}

.debug-content {
    padding: 10px 20px 20px;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.debug-content.show {
    display: block;
}

.toggle-debug {
    float: right;
}

.product-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
}

.product-card h4 {
    color: #333;
    margin-bottom: 8px;
}

.product-card p {
    color: #666;
    font-size: 14px;
}

.product-card .price {
    font-size: 18px;
    font-weight: bold;
    color: #28a745;
    margin: 8px 0;
}

#tools-list {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-tag {
    background: #e9ecef;
    color: #495057;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

.product-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    background: white;
}

.product-card img {
    max-width: 100px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #dee2e6;
}

.message.assistant .product-card {
    background: #f8f9fa;
}

#clear-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#clear-btn:hover {
    background: #5a6268;
}

.product-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.product-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.message.assistant .product-card {
    background: #f8f9fa;
}

/* Product display styles */
.product-details {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    border-left: 4px solid #007bff;
}

.message.assistant .product-details {
    background: #f0f7ff;
}

.product-details strong {
    color: #007bff;
    font-size: 1.1em;
}

.product-details code {
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Image styling */
.message img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 10px 0;
}

/* Product card layout */
.product-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.product-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
}

.product-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.product-price {
    color: #007bff;
    font-weight: bold;
    margin: 5px 0;
}

.product-attributes {
    font-size: 0.9em;
    color: #666;
    margin: 5px 0;
}

.product-id {
    font-family: monospace;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Checkout and Order styles */
.checkout-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8f5e9 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 10px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.order-complete {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8f5e9 100%);
    border-radius: 12px;
    padding: 25px;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.2);
    border: 1px solid #c8e6c9;
}

.session-id {
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9em;
    border: 1px solid #e0e0e0;
}

.total-amount {
    color: #4caf50;
    font-weight: bold;
    font-size: 1.3em;
}

.status-badge {
    background: #4caf50;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    display: inline-block;
}

.receipt-link {
    color: #007bff;
    text-decoration: none;
    padding: 5px 10px;
    background: #e3f2fd;
    border-radius: 4px;
    transition: background 0.2s;
}

.receipt-link:hover {
    background: #bbdefb;
    text-decoration: none;
}

.error-card {
    background: #ffebee;
    border-left: 4px solid #f44336;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}

.success-icon {
    font-size: 28px;
    margin-right: 10px;
}

/* Thinking Animation */
.thinking {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8f0fe 100%) !important;
    border-left: 4px solid #007bff !important;
}

.thinking-text {
    font-weight: 500;
    color: #007bff;
}

.thinking-dots {
    display: inline-block;
    margin-left: 4px;
}

.dot {
    display: inline-block;
    font-size: 1.5rem;
    line-height: 1;
    color: #007bff;
    opacity: 0;
    animation: blink 1.4s infinite;
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        background: linear-gradient(135deg, #f5f7fa 0%, #e8f0fe 100%);
    }
    50% {
        transform: scale(1.02);
        background: linear-gradient(135deg, #e8f0fe 0%, #d9e6f5 100%);
    }
}

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

/* Typing indicator for assistant */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #e9ecef;
    border-radius: 18px 18px 18px 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* DeepSeek-style thinking block */
.deepseek-thinking {
    background: #f0f7ff;
    border-left: 4px solid #10a37f;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.deepseek-thinking .header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #10a37f;
    font-weight: 500;
    margin-bottom: 8px;
}

.deepseek-thinking .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #10a37f;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.deepseek-thinking .dots {
    display: flex;
    gap: 4px;
    margin-left: 4px;
}

.deepseek-thinking .dots span {
    width: 4px;
    height: 4px;
    background: #10a37f;
    border-radius: 50%;
    animation: wave 1.5s infinite;
}

.deepseek-thinking .dots span:nth-child(2) { animation-delay: 0.2s; }
.deepseek-thinking .dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Message fade-in animation */
.message {
    animation: slideIn 0.3s ease-out;
}

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

/* Typing cursor effect */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #007bff;
    margin-left: 2px;
    animation: cursorBlink 1s infinite;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Progress bar for long operations */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #00d4ff);
    animation: progress 2s infinite;
}

@keyframes progress {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 50%; margin-left: 25%; }
    100% { width: 0%; margin-left: 100%; }
}

/* Simple Thinking Animation */
.thinking-content {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f0f7ff;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
}

.thinking-text {
    color: #007bff;
    font-weight: 500;
}

.thinking-dots {
    color: #007bff;
    font-weight: bold;
    font-size: 1.2em;
    min-width: 24px;
    text-align: left;
    animation: pulse 1s infinite;
}

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

/* Alternative bouncing dots */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.message.assistant .thinking-dots {
    display: inline-block;
}

.message.assistant .thinking-dots span {
    display: inline-block;
    animation: bounce 1s infinite;
}

/* Simple fade for thinking removal */
@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

.message.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}
