/* Advanced ChatGPT-like Interface Styles */

/* Global Styles */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #2f2f2f;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
}

/* Sidebar Animations */
#sidebar {
    transition: transform 0.3s ease-in-out;
}

@media (max-width: 1024px) {
    #sidebar.hidden {
        transform: translateX(-100%);
    }
}

/* Message Bubbles */
.message {
    animation: messageSlideIn 0.3s ease-out;
    max-width: 85%;
}

.user-message {
    background: linear-gradient(135deg, #10a37f, #0d8f6b);
    color: white;
    margin-left: auto;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 8px rgba(16, 163, 127, 0.2);
}

.ai-message {
    background: #2f2f2f;
    color: #ececec;
    margin-right: auto;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid #4a4a4a;
}

.system-message {
    background: #1a1a1a;
    color: #b3b3b3;
    margin: 0 auto;
    border-radius: 12px;
    border: 1px solid #333;
    text-align: center;
    font-size: 0.875rem;
}

.message-content {
    padding: 12px 16px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.75rem;
    opacity: 0.7;
}

.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.message-action:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #2f2f2f;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid #4a4a4a;
    margin-right: auto;
    max-width: 85%;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #10a37f;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* File Upload Styles */
#drop-zone {
    transition: all 0.3s ease;
    cursor: pointer;
}

#drop-zone.drag-over {
    border-color: #10a37f;
    background: rgba(16, 163, 127, 0.1);
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #2f2f2f;
    border: 1px solid #4a4a4a;
    border-radius: 8px;
    font-size: 0.875rem;
}

.file-preview img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
}

.file-remove {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: #ececec;
    cursor: pointer;
    font-size: 0.75rem;
}

/* Code Syntax Highlighting */
.code-block {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    margin: 8px 0;
}

.code-header {
    display: flex;
    justify-content: between;
    align-items: center;
    padding: 8px 12px;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
    font-size: 0.75rem;
    color: #b3b3b3;
}

.code-content {
    padding: 12px;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Toast Notifications */
.toast {
    background: #2f2f2f;
    border: 1px solid #4a4a4a;
    border-radius: 8px;
    padding: 12px 16px;
    color: #ececec;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: toastSlideIn 0.3s ease-out;
    max-width: 300px;
}

.toast.success {
    border-color: #10a37f;
    background: rgba(16, 163, 127, 0.1);
}

.toast.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.toast.warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

/* Conversation List */
.conversation-item {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background: #2d2d2d;
}

.conversation-item.active {
    background: #2d2d2d;
    border-color: #10a37f;
}

.conversation-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #ececec;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    font-size: 0.75rem;
    color: #b3b3b3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

/* Input Area Enhancements */
#user-input {
    transition: all 0.2s ease;
    line-height: 1.5;
}

#user-input:focus {
    border-color: #10a37f;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

/* Auto-resize textarea */
#user-input {
    resize: none;
    overflow: hidden;
}

/* Quick Actions */
.quick-action {
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-action:hover {
    background: #4a4a4a;
    transform: translateY(-1px);
}

/* Modal Animations */
.modal {
    animation: modalFadeIn 0.3s ease-out;
}

.modal > div {
    animation: modalSlideIn 0.3s ease-out;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #4a4a4a;
    border-top: 2px solid #10a37f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 40;
    }
    
    .main-chat {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .message {
        max-width: 95%;
    }
    
    .quick-action {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    
    #chat-messages {
        padding: 16px 12px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #10a37f;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .message {
        border: 2px solid;
    }
    
    .user-message {
        border-color: #10a37f;
    }
    
    .ai-message {
        border-color: #ececec;
    }
}
