/* Reset & Base Styles */
.chatbot-shell,
.chatbot-shell * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.chatbot-page-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0 !important;
    overflow: hidden;
}

/* Main Layout Container */
.chatbot-shell {
    display: flex;
    width: 100%;
    height: 100vh;
    flex-direction: row;
    position: relative;
    background: #0f1419;
    color: #e8eaed;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Sidebar - Claude-style, Collapsible */
.sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #2d3748;
    background: #1a1f2e;
    color: #e8eaed;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-toggle-btn:hover {
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.chatbot-sidebar {
    flex: 0 0 280px;
    width: 280px;
    background: #1a1f2e;
    border-right: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
    padding: 14px 12px 12px;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    transition: width 0.3s ease, flex-basis 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.chatbot-shell.chatbot-sidebar-collapsed .chatbot-sidebar {
    flex-basis: 60px;
    width: 60px;
    padding: 14px 8px 12px;
}

.chatbot-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid #2d3748;
}

.chatbot-shell.chatbot-sidebar-collapsed .chatbot-sidebar-header {
    justify-content: center;
    border-bottom: none;
    padding: 0;
    margin-bottom: 0;
}

.chatbot-shell.chatbot-sidebar-collapsed .chatbot-sidebar-header > :not(.sidebar-toggle-btn),
.chatbot-shell.chatbot-sidebar-collapsed .new-chat-btn,
.chatbot-shell.chatbot-sidebar-collapsed .conversation-list,
.chatbot-shell.chatbot-sidebar-collapsed .chatbot-sidebar-profile {
    display: none;
}

@keyframes sidebarFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-shell.chatbot-sidebar-opening .chatbot-sidebar-header > :not(.sidebar-toggle-btn),
.chatbot-shell.chatbot-sidebar-opening .new-chat-btn,
.chatbot-shell.chatbot-sidebar-opening .conversation-group,
.chatbot-shell.chatbot-sidebar-opening .chatbot-sidebar-profile {
    opacity: 0;
    animation: sidebarFadeUp 0.34s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.chatbot-shell.chatbot-sidebar-opening .chatbot-sidebar-header > :not(.sidebar-toggle-btn) {
    animation-delay: 0.04s;
}

.chatbot-shell.chatbot-sidebar-opening .new-chat-btn {
    animation-delay: 0.1s;
}

.chatbot-shell.chatbot-sidebar-opening .conversation-group {
    animation-delay: 0.15s;
}

.chatbot-shell.chatbot-sidebar-opening .conversation-group:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-shell.chatbot-sidebar-opening .conversation-group:nth-child(3) {
    animation-delay: 0.24s;
}

.chatbot-shell.chatbot-sidebar-opening .conversation-row {
    opacity: 0;
    animation: sidebarFadeUp 0.28s ease forwards;
}


.chatbot-shell.chatbot-sidebar-opening .conversation-row:nth-child(2) { animation-delay: 0.2s; }
.chatbot-shell.chatbot-sidebar-opening .conversation-row:nth-child(3) { animation-delay: 0.23s; }
.chatbot-shell.chatbot-sidebar-opening .conversation-row:nth-child(4) { animation-delay: 0.26s; }
.chatbot-shell.chatbot-sidebar-opening .conversation-row:nth-child(5) { animation-delay: 0.29s; }
.chatbot-shell.chatbot-sidebar-opening .conversation-row:nth-child(6) { animation-delay: 0.32s; }

.chatbot-shell.chatbot-sidebar-opening .chatbot-sidebar-profile {
    animation-delay: 0.26s;
}

.chatbot-logo {
    font-size: 20px;
    font-weight: 700;
    color: #6c5ce7;
    letter-spacing: -0.2px;
}

/* Conversation History */
.conversation-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 10px;
    overflow-y: auto;
    padding-right: 4px;
}

.conversation-list::-webkit-scrollbar {
    width: 6px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: #3d4557;
    border-radius: 999px;
}

.conversation-group-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    padding: 0 10px;
    margin-bottom: 4px;
}

.conversation-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
}

.conversation-item {
    flex: 1;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #b0b3b8;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.conversation-item:hover {
    background: #252d3d;
    color: #e8eaed;
    border-color: #2d3748;
}

.conversation-item.active {
    background: rgba(108, 92, 231, 0.14);
    color: #f4f2ff;
    border-color: rgba(108, 92, 231, 0.3);
}

.conversation-delete {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: #b0b3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.conversation-row:hover .conversation-delete,
.conversation-delete:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.conversation-delete:hover {
    color: #ffffff;
    border-color: #2d3748;
    background: #252d3d;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 8px;
    padding: 11px 16px;
    background: #6c5ce7;
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    margin-bottom: 16px;
}

.new-chat-btn:hover {
    background: #7d6cf7;
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.25);
}

.new-chat-btn:active {
    transform: scale(0.98);
}

.chatbot-sidebar-profile {
    border-top: 1px solid #2d3748;
    margin-top: auto;
    padding: 12px 10px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d1d5db;
}

.chatbot-sidebar-profile .material-symbols-outlined {
    font-size: 24px;
    color: #b0b3b8;
}

.chatbot-profile-name {
    font-size: 14px;
    font-weight: 500;
}

/* Main Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f1419;
}

/* Header */
.app-header {
    background: #0f1419;
    border-bottom: 1px solid #2d3748;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.heading {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #2d3748;
    background: #1a1f2e;
    color: #e8eaed;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.chat-action-btn:hover {
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.inline-confirm {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #b0b3b8;
    background: #1a1f2e;
    border: 1px solid #2d3748;
    border-radius: 10px;
    padding: 6px 8px;
}

.inline-confirm button {
    background: transparent;
    color: #e8eaed;
    border: 1px solid #3d4557;
    border-radius: 8px;
    padding: 8px 16px;
    min-height: 36px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    font-family: inherit;
    cursor: pointer;
}

.inline-confirm button:hover {
    border-color: #6c5ce7;
}

/* Chat Messages Area */
.chatbox {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #0f1419;
}

.chatbox::-webkit-scrollbar {
    width: 8px;
}

.chatbox::-webkit-scrollbar-track {
    background: transparent;
}

.chatbox::-webkit-scrollbar-thumb {
    background: #3d4557;
    border-radius: 4px;
}

.chatbox::-webkit-scrollbar-thumb:hover {
    background: #4d5567;
}

/* Welcome State */
.welcome-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 60px 40px;
    text-align: center;
}

.welcome-icon {
    font-size: 64px;
    color: #6c5ce7;
    opacity: 0.8;
}

.welcome-title {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
}

.welcome-subtitle {
    font-size: 16px;
    font-weight: 400;
    color: #9ca3af;
    max-width: 500px;
    line-height: 1.6;
}

/* Suggestions Container */
.suggestions-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
}

.suggestion-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: #1a1f2e;
    border: 1px solid #2d3748;
    border-radius: 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #e8eaed;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}

.suggestion-btn:hover {
    background: #252d3d;
    border-color: #6c5ce7;
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.suggestion-btn:active {
    transform: scale(0.98);
}

.suggestion-btn .icon {
    font-size: 18px;
    flex-shrink: 0;
    color: #6c5ce7;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: #6c5ce7;
    color: #ffffff;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
}

.message.user .message-content {
    align-items: flex-end;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 14px;
    font-weight: 400;
}

.message.user .message-bubble {
    background: #6c5ce7;
    color: #ffffff;
    border-radius: 16px 4px 16px 16px;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.2);
}

.message.bot .message-bubble {
    background: #1a1f2e;
    color: #e8eaed;
    border: 1px solid #2d3748;
    border-radius: 4px 16px 16px 16px;
}

.message-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 20px;
}

.copy-btn {
    border: 1px solid #2d3748;
    background: #1a1f2e;
    color: #b0b3b8;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.message.bot:hover .copy-btn,
.copy-btn:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.copy-btn:hover {
    color: #ffffff;
    border-color: #6c5ce7;
}

.copied-tip {
    font-size: 11px;
    color: #9ca3af;
    opacity: 0;
    transform: translateY(2px);
    transition: all 0.18s ease;
}

.copied-tip.visible {
    opacity: 1;
    transform: translateY(0);
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.attachment-item {
    background: #252d3d;
    border: 1px solid #3d4557;
    border-radius: 10px;
    padding: 6px 8px;
    color: #e8eaed;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 240px;
}

.attachment-thumb,
.attachment-video-thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    background: #1a1f2e;
}

.attachment-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Input Section - Fixed at Bottom */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 28px 40px;
    background: #0f1419;
    border-top: 1px solid #2d3748;
}

.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-chip {
    background: #1a1f2e;
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 280px;
}

.attachment-chip .remove-chip {
    border: none;
    background: transparent;
    color: #b0b3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.attachment-chip .remove-chip:hover {
    color: #ffffff;
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1f2e;
    border: 1px solid #2d3748;
    border-radius: 24px;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

#attachBtn {
    padding: 8px 10px;
    background: transparent;
    border: none;
    color: #6c5ce7;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#attachBtn:hover {
    color: #7d6cf7;
    transform: scale(1.06);
}

.input-wrapper:focus-within {
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
    background: #1f2536;
}

#userMessage {
    flex: 1;
    background: transparent;
    border: none;
    color: #e8eaed;
    font-size: 14px;
    font-weight: 400;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    max-height: 100px;
    line-height: 20px;
    padding: 10px 0;
}

#userMessage::placeholder {
    color: #6b7280;
}

#sendBtn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #6c5ce7;
    font-size: 18px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sendBtn:hover:not(:disabled) {
    color: #7d6cf7;
    transform: scale(1.1);
}

#sendBtn:active:not(:disabled) {
    transform: scale(0.95);
}

#sendBtn:disabled {
    background: #2d3447;
    border-color: #2d3447;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .chatbot-sidebar {
        flex-basis: 250px;
        width: 250px;
    }

    .chatbot-shell.chatbot-sidebar-collapsed .chatbot-sidebar {
        flex-basis: 56px;
        width: 56px;
    }

    .suggestions-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .message-content {
        max-width: 80%;
    }
}

@media (max-width: 768px) {
    .chatbot-sidebar {
        flex-basis: 240px;
        width: 240px;
    }

    .chatbot-shell.chatbot-sidebar-collapsed .chatbot-sidebar {
        flex-basis: 56px;
        width: 56px;
    }

    .conversation-delete,
    .copy-btn {
        opacity: 1;
        pointer-events: auto;
    }

    .app-header {
        padding: 16px 20px;
    }

    .heading {
        font-size: 24px;
    }

    .chatbox {
        padding: 24px 20px;
        gap: 16px;
    }

    .welcome-section {
        padding: 40px 20px;
        gap: 24px;
    }

    .welcome-title {
        font-size: 28px;
    }

    .suggestions-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 10px;
    }

    .suggestion-btn {
        padding: 14px 16px;
        font-size: 13px;
    }

    .input-section {
        padding: 16px 20px;
        gap: 8px;
    }

    .message-content {
        max-width: 85%;
    }

    .message-bubble {
        padding: 12px 14px;
        font-size: 13px;
    }

    #userMessage {
        font-size: 13px;
        line-height: 20px;
        padding: 10px 0;
    }

    #sendBtn {
        padding: 10px 20px;
        font-size: 13px;
    }

    #attachBtn {
        padding: 10px 8px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 12px 16px;
    }

    .heading {
        font-size: 20px;
    }

    .chatbox {
        padding: 16px;
        gap: 12px;
    }

    .welcome-section {
        padding: 32px 16px;
        gap: 20px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-icon {
        font-size: 48px;
    }

    .suggestions-grid {
        grid-template-columns: 1fr;
    }

    .suggestion-btn {
        padding: 12px 14px;
        font-size: 12px;
    }

    .input-section {
        padding: 12px 16px;
    }

    .message-content {
        max-width: 90%;
    }
}
