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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #2d2d2d;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 600px;
    height: 600px;
    background: #3a3a3a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
}

/* Top Header */
.top-header {
    background: linear-gradient(135deg, #8B6F47 0%, #C4A57B 100%);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px 12px 0 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.headphone-icon {
    color: white;
}

.header-title {
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.close-button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.close-button:hover {
    opacity: 0.8;
}

/* Profile Section (scrollable) */
.profile-section {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 0.75rem;
    border: 2px solid #C4A57B;
}

.profile-name {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    letter-spacing: 0.5px;
}

.profile-subtitle {
    color: #aaa;
    font-size: 0.75rem;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    scroll-behavior: smooth;
    background: #3a3a3a;
}

/* Messages */
.message {
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease-in-out;
}

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

.message-bubble {
    display: inline-block;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.5;
}

.message-sender {
    font-weight: 600;
    margin-right: 0.25rem;
}

.bot-message {
    text-align: left;
}

.bot-message .message-bubble {
    background: #4a4a4a;
    color: white;
    border-top-left-radius: 4px;
}

.user-message {
    text-align: right;
}

.user-message .message-bubble {
    background: #5a5a5a;
    color: white;
    border-top-right-radius: 4px;
    margin-left: auto;
}

.user-message .message-sender {
    color: #C4A57B;
}

/* Markdown Styles */
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.message-bubble p {
    margin-bottom: 0.5rem;
}

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

.message-bubble ul, .message-bubble ol {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
    list-style-type: disc;
}

.message-bubble ul ul {
    margin-left: 1rem;
    margin-top: 0.25rem;
    list-style-type: circle;
}

.message-bubble li {
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.message-bubble li p {
    display: inline;
    margin: 0;
}

.message-bubble strong {
    color: #C4A57B;
    font-weight: 600;
}

.message-bubble img {
    max-width: 120px;
    height: auto;
    border-radius: 8px;
    margin-top: 0.5rem;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.message-bubble code {
    background: rgba(196, 165, 123, 0.2);
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.message-bubble pre {
    background: #2d2d2d;
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.message-bubble blockquote {
    border-left: 4px solid #C4A57B;
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: #ccc;
}

.message-bubble a {
    color: #C4A57B;
    text-decoration: underline;
    font-size: 0.9rem;
}

.message-bubble a:hover {
    color: #e5c590;
}

/* Product Card Styles */
.message-bubble .product-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 1rem;
    margin: 0.75rem 0;
    border: 1px solid rgba(196, 165, 123, 0.2);
    transition: all 0.3s ease;
}

.message-bubble .product-card:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(196, 165, 123, 0.4);
}

.message-bubble .product-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.message-bubble .product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.message-bubble .product-info {
    flex: 1;
    min-width: 0;
}

.message-bubble .product-title {
    color: #C4A57B;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.message-bubble .product-price {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}

.message-bubble .product-description {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.75rem 0;
}

.message-bubble .product-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #8B6F47 0%, #C4A57B 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.message-bubble .product-link:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(196, 165, 123, 0.4);
}

/* Multiple product cards spacing */
.message-bubble .product-card + .product-card {
    margin-top: 1rem;
}

/* Input Area */
.input-area {
    padding: 0;
    background: #4a4a4a;
    border-top: 1px solid #555;
}

.input-container {
    display: flex;
    align-items: center;
    position: relative;
}

.message-input {
    flex: 1;
    padding: 1rem 3.5rem 1rem 1rem;
    border: none;
    resize: none;
    font-size: 0.95rem;
    font-family: inherit;
    min-height: 50px;
    max-height: 120px;
    background: #4a4a4a;
    color: white;
}

.message-input::placeholder {
    color: #999;
}

.message-input:focus {
    outline: none;
}

.send-button {
    position: absolute;
    right: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: none;
    background: linear-gradient(135deg, #8B6F47 0%, #C4A57B 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(196, 165, 123, 0.4);
}

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

.send-button svg {
    width: 20px;
    height: 20px;
}

.send-button svg .fa-primary {
    fill: white;
}

.send-button svg .fa-secondary {
    fill: white;
}


/* Loading animation */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 0.75rem 1rem;
    background: #4a4a4a;
    border-radius: 18px;
    border-top-left-radius: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #C4A57B;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Scrollbar styles */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .profile-section {
        padding: 1.5rem 1rem;
    }
    
    .message-bubble {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .chat-messages {
        padding: 1rem;
    }
    
    .message-bubble {
        font-size: 0.95rem;
    }
}