:root {
    --eightmds-primary: #2563eb;
    --eightmds-primary-hover: #1d4ed8;
    --eightmds-primary-light: #dbeafe;
    --eightmds-secondary: #64748b;
    --eightmds-success: #10b981;
    --eightmds-danger: #ef4444;
    --eightmds-background: #f8fafc;
    --eightmds-surface: #ffffff;
    --eightmds-border: #e2e8f0;
    --eightmds-text: #1e293b;
    --eightmds-text-light: #64748b;
    --eightmds-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --eightmds-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --eightmds-transition: all 0.2s ease;
}

* {
    box-sizing: border-box;
}

.eightmds-workspace-container {
    display: flex;
    height: calc(100vh - 32px);
    background: var(--eightmds-background);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--eightmds-text);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--eightmds-shadow-lg);
    margin: 20px;
}

.eightmds-sidebar {
    width: 280px;
    background: var(--eightmds-surface);
    border-right: 1px solid var(--eightmds-border);
    display: flex;
    flex-direction: column;
    transition: var(--eightmds-transition);
}

.eightmds-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--eightmds-border);
}

.eightmds-sidebar-header h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--eightmds-text);
}

.eightmds-new-chat,
.eightmds-delete-all-chats {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--eightmds-transition);
}

.eightmds-new-chat {
    background: var(--eightmds-primary);
    color: white;
    margin-bottom: 8px;
}

.eightmds-new-chat:hover {
    background: var(--eightmds-primary-hover);
    transform: translateY(-1px);
}

.eightmds-new-chat:active {
    transform: translateY(0);
}

.eightmds-delete-all-chats {
    background: transparent;
    color: #d63638;
    border: 1px solid #d63638;
}

.eightmds-delete-all-chats:hover {
    background: #d63638;
    color: white;
}

.eightmds-delete-all-chats svg {
    stroke: currentColor;
}

/* Delete All Confirmation Modal */
.eightmds-delete-all-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    animation: fadeIn 0.2s ease;
}

.eightmds-delete-all-modal.open {
    display: block;
}

.eightmds-delete-all-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.eightmds-delete-all-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: slideUp 0.3s ease;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.eightmds-delete-all-icon {
    margin: 0 auto 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.eightmds-delete-all-content h2 {
    margin: 0 0 15px 0;
    color: #1d2327;
    font-size: 24px;
    font-weight: 600;
}

.eightmds-delete-all-content p {
    margin: 0 0 15px 0;
    color: #50575e;
    font-size: 15px;
    line-height: 1.6;
}

.eightmds-delete-warning {
    color: #d63638;
    font-weight: 600;
    margin-bottom: 30px !important;
}

.eightmds-delete-all-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.eightmds-modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.eightmds-modal-btn-cancel {
    background: #f0f0f1;
    color: #2c3338;
}

.eightmds-modal-btn-cancel:hover {
    background: #dcdcde;
}

.eightmds-modal-btn-danger {
    background: #d63638;
    color: white;
}

.eightmds-modal-btn-danger:hover {
    background: #b32d2e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(214, 54, 56, 0.3);
}

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

.eightmds-conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.eightmds-conversation-item {
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--eightmds-transition);
    border: 1px solid transparent;
}

.eightmds-conversation-item:hover {
    background: var(--eightmds-primary-light);
    border-color: var(--eightmds-primary);
}

.eightmds-conversation-item.active {
    background: var(--eightmds-primary-light);
    border-color: var(--eightmds-primary);
}

.eightmds-conversation-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--eightmds-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eightmds-conversation-date {
    font-size: 12px;
    color: var(--eightmds-text-light);
}

.eightmds-loading {
    text-align: center;
    padding: 20px;
    color: var(--eightmds-text-light);
    font-size: 14px;
}

.eightmds-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--eightmds-surface);
}

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

.eightmds-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--eightmds-text);
}

.eightmds-chat-actions {
    display: flex;
    gap: 8px;
}

.eightmds-rename-chat,
.eightmds-delete-chat {
    padding: 8px;
    background: transparent;
    border: 1px solid var(--eightmds-border);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--eightmds-transition);
    color: var(--eightmds-text);
}

.eightmds-rename-chat:hover {
    background: var(--eightmds-primary-light);
    border-color: var(--eightmds-primary);
    color: var(--eightmds-primary);
}

.eightmds-delete-chat:hover {
    background: #fee2e2;
    border-color: var(--eightmds-danger);
    color: var(--eightmds-danger);
}

.eightmds-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
}

.eightmds-welcome-message {
    text-align: center;
    max-width: 800px;
    margin: 40px auto;
}

.eightmds-welcome-icon {
    color: var(--eightmds-primary);
    margin-bottom: 20px;
}

.eightmds-welcome-message h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--eightmds-text);
}

.eightmds-welcome-message > p {
    font-size: 16px;
    color: var(--eightmds-text-light);
    margin-bottom: 32px;
}

.eightmds-capabilities {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.eightmds-capability {
    padding: 20px;
    background: var(--eightmds-background);
    border-radius: 8px;
    border: 1px solid var(--eightmds-border);
    text-align: left;
    cursor: pointer;
    transition: var(--eightmds-transition);
}

.eightmds-capability:hover {
    background: var(--eightmds-surface);
    border-color: var(--eightmds-primary);
    transform: translateY(-2px);
    box-shadow: var(--eightmds-shadow);
}

.eightmds-capability h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--eightmds-primary);
}

.eightmds-capability p {
    font-size: 13px;
    color: var(--eightmds-text-light);
    margin: 0;
    line-height: 1.5;
}

.eightmds-welcome-footer {
    font-size: 14px;
    color: var(--eightmds-text-light);
}

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

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

.eightmds-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
}

.eightmds-message.user .eightmds-message-avatar {
    background: var(--eightmds-primary);
    color: white;
}

.eightmds-message.assistant .eightmds-message-avatar {
    background: var(--eightmds-success);
    color: white;
}

.eightmds-message-content {
    flex: 1;
    max-width: calc(100% - 48px);
}

.eightmds-message-role {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--eightmds-text-light);
}

.eightmds-message-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--eightmds-text);
    word-wrap: break-word;
    white-space: pre-wrap;
}

.eightmds-message.user .eightmds-message-text {
    background: var(--eightmds-background);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--eightmds-border);
}

.eightmds-message.assistant .eightmds-message-text {
    padding: 4px 0;
}

.eightmds-typing-indicator {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.eightmds-typing-indicator .eightmds-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--eightmds-success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.eightmds-typing-dots {
    background: var(--eightmds-background);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--eightmds-border);
    display: flex;
    gap: 4px;
    align-items: center;
}

.eightmds-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--eightmds-text-light);
    animation: typing 1.4s infinite;
}

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

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

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

.eightmds-input-area {
    padding: 20px 24px;
    border-top: 1px solid var(--eightmds-border);
    background: var(--eightmds-surface);
}

.eightmds-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: var(--eightmds-background);
    border: 2px solid var(--eightmds-border);
    border-radius: 12px;
    padding: 12px;
    transition: var(--eightmds-transition);
}

.eightmds-input-wrapper:focus-within {
    border-color: var(--eightmds-primary);
    background: var(--eightmds-surface);
}

.eightmds-message-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    font-family: inherit;
    background: transparent;
    color: var(--eightmds-text);
    line-height: 1.5;
    max-height: 200px;
    min-height: 24px;
}

.eightmds-message-input::placeholder {
    color: var(--eightmds-text-light);
}

.eightmds-attach-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--eightmds-border);
    background: transparent;
    color: var(--eightmds-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--eightmds-transition);
    flex-shrink: 0;
}

.eightmds-attach-button:hover {
    background: var(--eightmds-primary-light);
    border-color: var(--eightmds-primary);
    color: var(--eightmds-primary);
}

.eightmds-attached-files {
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.eightmds-attached-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--eightmds-primary-light);
    border: 1px solid var(--eightmds-primary);
    border-radius: 8px;
    font-size: 13px;
    color: var(--eightmds-text);
}

.eightmds-attached-file-icon {
    width: 20px;
    height: 20px;
    color: var(--eightmds-primary);
}

.eightmds-attached-file-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eightmds-attached-file-size {
    color: var(--eightmds-text-light);
    font-size: 11px;
}

.eightmds-remove-file {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--eightmds-danger);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--eightmds-transition);
}

.eightmds-remove-file:hover {
    background: var(--eightmds-danger);
    color: white;
}

.eightmds-send-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: var(--eightmds-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--eightmds-transition);
    flex-shrink: 0;
}

.eightmds-send-button:hover:not(:disabled) {
    background: var(--eightmds-primary-hover);
    transform: translateY(-1px);
}

.eightmds-send-button:active:not(:disabled) {
    transform: translateY(0);
}

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

.eightmds-input-footer {
    margin-top: 12px;
    text-align: center;
}

.eightmds-input-footer small {
    color: var(--eightmds-text-light);
    font-size: 12px;
}

.eightmds-error-message {
    background: #fee2e2;
    border: 1px solid var(--eightmds-danger);
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

@media (max-width: 1024px) {
    .eightmds-workspace-container {
        margin: 10px;
        height: calc(100vh - 20px);
    }

    .eightmds-sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .eightmds-workspace-container {
        margin: 0;
        height: 100vh;
        border-radius: 0;
    }

    .eightmds-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        width: 280px;
        box-shadow: var(--eightmds-shadow-lg);
    }

    .eightmds-sidebar.open {
        transform: translateX(0);
    }

    .eightmds-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .eightmds-sidebar-overlay.open {
        display: block;
    }

    .eightmds-mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 20px;
        border-bottom: 1px solid var(--eightmds-border);
    }

    .eightmds-menu-toggle {
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        cursor: pointer;
        padding: 8px;
        border-radius: 6px;
        transition: var(--eightmds-transition);
        color: var(--eightmds-text);
    }

    .eightmds-menu-toggle:hover {
        background: var(--eightmds-background);
    }

    .eightmds-chat-header {
        display: none;
    }

    .eightmds-capabilities {
        grid-template-columns: 1fr;
    }

    .eightmds-chat-messages {
        padding: 16px;
    }

    .eightmds-input-area {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .eightmds-welcome-message h2 {
        font-size: 24px;
    }

    .eightmds-message-text {
        font-size: 14px;
    }

    .eightmds-message-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

.eightmds-conversations-list::-webkit-scrollbar,
.eightmds-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.eightmds-conversations-list::-webkit-scrollbar-track,
.eightmds-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.eightmds-conversations-list::-webkit-scrollbar-thumb,
.eightmds-chat-messages::-webkit-scrollbar-thumb {
    background: var(--eightmds-border);
    border-radius: 4px;
}

.eightmds-conversations-list::-webkit-scrollbar-thumb:hover,
.eightmds-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--eightmds-secondary);
}

/* Modal Styles */
.eightmds-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.eightmds-modal.open {
    display: flex;
}

.eightmds-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.eightmds-modal-content {
    position: relative;
    background: var(--eightmds-surface);
    border-radius: 12px;
    box-shadow: var(--eightmds-shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

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

.eightmds-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--eightmds-text);
}

.eightmds-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--eightmds-text);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--eightmds-transition);
}

.eightmds-modal-close:hover {
    background: var(--eightmds-background);
    color: var(--eightmds-danger);
}

.eightmds-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.eightmds-template-item {
    padding: 16px;
    background: var(--eightmds-background);
    border: 2px solid var(--eightmds-border);
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--eightmds-transition);
}

.eightmds-template-item:hover {
    background: var(--eightmds-surface);
    border-color: var(--eightmds-primary);
    transform: translateX(4px);
}

.eightmds-template-item h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--eightmds-text);
}

.eightmds-template-item p {
    margin: 0;
    font-size: 13px;
    color: var(--eightmds-text-light);
    line-height: 1.5;
}

@media (max-width: 768px) {
    .eightmds-modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .eightmds-modal-body {
        padding: 16px;
    }
}

/* Modal Back Button */
.eightmds-modal-back {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--eightmds-text);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--eightmds-transition);
    margin-right: 8px;
}

.eightmds-modal-back:hover {
    background: var(--eightmds-background);
    color: var(--eightmds-primary);
}

/* Modal Footer */
.eightmds-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--eightmds-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Buttons */
.eightmds-btn-primary,
.eightmds-btn-secondary {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--eightmds-transition);
    border: none;
}

.eightmds-btn-primary {
    background: var(--eightmds-primary);
    color: white;
}

.eightmds-btn-primary:hover {
    background: var(--eightmds-primary-hover);
    transform: translateY(-1px);
}

.eightmds-btn-secondary {
    background: transparent;
    color: var(--eightmds-text);
    border: 1px solid var(--eightmds-border);
}

.eightmds-btn-secondary:hover {
    background: var(--eightmds-background);
    border-color: var(--eightmds-text-light);
}

/* Form Fields */
.eightmds-form-group {
    margin-bottom: 20px;
}

.eightmds-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--eightmds-text);
    margin-bottom: 8px;
}

.eightmds-form-group input,
.eightmds-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--eightmds-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--eightmds-text);
    background: var(--eightmds-background);
    transition: var(--eightmds-transition);
}

.eightmds-form-group input:focus,
.eightmds-form-group textarea:focus {
    outline: none;
    border-color: var(--eightmds-primary);
    background: var(--eightmds-surface);
}

.eightmds-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.eightmds-form-helper {
    font-size: 12px;
    color: var(--eightmds-text-light);
    margin-top: 4px;
}
