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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #2e1065 0%, #581c87 50%, #6b21a5 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    border-radius: 32px;
    padding: 40px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease;
}

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

.modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.ai-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    box-shadow: 0 10px 30px -5px #8b5cf6;
}

.modal-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1e1b4b;
}

.gradient-text {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    color: #6b7280;
    font-size: 16px;
}

.modal-body {
    margin-bottom: 32px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #1e1b4b;
}

.input-group input {
    padding: 16px 20px;
    border: 2px solid #e9d5ff;
    border-radius: 16px;
    font-size: 16px;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
}

.input-group input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.modal-footer {
    text-align: center;
    margin-bottom: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    box-shadow: 0 10px 20px -5px #8b5cf6;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 30px -5px #8b5cf6;
}

.modal-note {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
}

/* Chat Container */
.chat-container {
    width: 100%;
    max-width: 1000px;
    height: 90vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 32px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s ease;
    border: 2px solid rgba(139, 92, 246, 0.2);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar-small {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.header-info h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #faf5ff;
}

.message {
    margin-bottom: 20px;
    display: flex;
    animation: messageSlide 0.3s ease;
}

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

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 14px 20px;
    border-radius: 24px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.message.bot .message-content {
    background: white;
    border: 2px solid #e9d5ff;
    color: #1e1b4b;
    border-bottom-left-radius: 8px;
}

.message.user .message-content {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    border-bottom-right-radius: 8px;
}

/* Message Images */
.message-image {
    max-width: 300px;
    border-radius: 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.3s;
    border: 3px solid #e9d5ff;
}

.message-image:hover {
    transform: scale(1.02);
}

.generated-image {
    border: 3px solid #8b5cf6;
}

/* Image Preview */
.image-preview-container {
    padding: 16px 24px;
    background: #f5f3ff;
    border-top: 2px solid #e9d5ff;
}

.image-preview {
    position: relative;
    display: inline-block;
}

.image-preview img {
    max-height: 150px;
    border-radius: 12px;
    border: 3px solid #8b5cf6;
}

.close-preview {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Chat Input */
.chat-input-container {
    padding: 20px 24px;
    background: white;
    border-top: 2px solid #e9d5ff;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.action-btn {
    background: #f5f3ff;
    border: 2px solid #e9d5ff;
    color: #6d28d9;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.action-btn:hover {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
    transform: scale(1.05);
}

.chat-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e9d5ff;
    border-radius: 50px;
    font-size: 15px;
    resize: none;
    font-family: 'Inter', sans-serif;
    max-height: 120px;
    outline: none;
    transition: all 0.3s;
}

.chat-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.send-button {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    border: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05) rotate(-10deg);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.send-button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    box-shadow: none;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e9d5ff;
    border-radius: 24px;
    border-bottom-left-radius: 8px;
}

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

.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.6; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* Token Info */
.token-info {
    text-align: center;
    font-size: 11px;
    color: #6d28d9;
    margin: 8px 0;
    padding: 4px 12px;
    background: #ede9fe;
    border-radius: 50px;
    display: inline-block;
    align-self: center;
    border: 1px solid #c4b5fd;
}

/* Footer */
.footer-note {
    padding: 10px 24px;
    background: #f5f3ff;
    text-align: center;
    font-size: 12px;
    color: #6d28d9;
    border-top: 2px solid #e9d5ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.model-info {
    background: #ede9fe;
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .message-content {
        max-width: 85%;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .user-profile {
        display: none;
    }
}

@media (max-width: 480px) {
    .action-btn {
        width: 40px;
        height: 40px;
    }
    
    .send-button {
        width: 44px;
        height: 44px;
    }
    
    .chat-input {
        padding: 10px 16px;
    }
}

