/* --- lora CLEAN ENTERPRISE REDESIGN (ChatGPT / Gemini Style) --- */

#tab-chat:not(.hidden) {
    background-color: #ffffff !important;
    min-height: 85vh;
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    display: flex;
    overflow: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    border: 1px solid #f1f5f9;
}

.lora-chat-wrapper {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.lora-sidebar {
    width: 260px;
    background: #fcfcfd;
    border-right: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
}

.lora-new-chat-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 24px;
}

.lora-new-chat-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.lora-history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lora-history-item {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    color: #64748b;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.lora-history-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.lora-history-item.active {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 600;
}

.lora-history-item .delete-thread {
    position: absolute;
    right: 10px;
    opacity: 0;
    color: #94a3b8;
    transition: 0.2s;
}

.lora-history-item:hover .delete-thread {
    opacity: 1;
}

/* Main Area */
.lora-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative;
    max-height: 85vh;
    min-width: 0;
    /* Fix overflow in some flex contexts */
}

.lora-chat-header {
    padding: 20px 32px;
    border-bottom: 1px solid #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#lora-messages {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    box-sizing: border-box;
    /* FIX: Prevents overflow due to padding */
}

#lora-messages::-webkit-scrollbar {
    display: none;
}

/* Messages */
.lora-msg-row {
    display: flex;
    gap: 20px;
    width: 100%;
    animation: slideIn 0.3s ease-out;
}

.lora-left {
    justify-content: flex-start;
}

.lora-right {
    justify-content: flex-end;
}

.lora-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #ffffff;
    border: 1.5px solid #f1f5f9;
    flex-shrink: 0;
    object-fit: contain;
}

.lora-bubble {
    font-size: 15px;
    line-height: 1.65;
    color: #334155;
    max-width: calc(100% - 70px);
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* Modern wrapping */
    box-sizing: border-box;
}

.lora-bubble img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
    display: block;
}

.lora-left .lora-bubble {
    padding-top: 5px;
}

.lora-right .user-bubble {
    background: #f8fafc;
    color: #1e293b;
    padding: 14px 20px;
    border-radius: 20px;
    border-bottom-right-radius: 4px;
    max-width: 85%;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

/* Input Area */
.lora-input-area {
    padding: 24px 32px 32px 32px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.lora-input-box {
    width: 100%;
    max-width: 800px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 10px 10px 20px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.lora-input-box:focus-within {
    border-color: #cbd5e1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

#lora-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    font-size: 15px;
    color: #1e293b;
    outline: none !important;
    padding: 10px 0 !important;
    resize: none !important;
    min-height: 24px;
    max-height: 180px;
    line-height: 1.5;
}

#lora-send {
    background: #0f172a !important;
    color: #ffffff !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 12px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-bottom: 2px;
}

#lora-send:hover {
    background: #1e293b !important;
    transform: scale(1.05);
}

/* Markdown Styling */
.lora-bubble h3,
.lora-bubble h4 {
    margin: 20px 0 10px 0;
    font-weight: 700;
    color: #0f172a;
}

.lora-bubble p {
    margin-bottom: 12px;
}

.lora-bubble table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
    font-size: 14px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.lora-bubble th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #475569;
}

.lora-bubble td {
    padding: 10px 16px;
    border-top: 1px solid #f8fafc;
    color: #64748b;
}

.lora-bubble code:not(pre code) {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.9em;
    color: #be123c;
}

.lora-bubble pre {
    background: #1e293b;
    color: #f8fafc;
    padding: 20px;
    border-radius: 14px;
    margin: 20px 0;
    overflow-x: auto;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing */
#lora-typing .lora-bubble {
    color: #94a3b8;
    font-style: italic;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}
