/* AI Workspace Header Nav tweaks */
.nav-container.main-nav > li > a {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    letter-spacing: 0.3px;
}
.nav-container.main-nav > li > a:hover {
    color: #333;
}
.nav-container.main-nav > li.active > a {
    color: #6d468c;
    color: var(--primary, #6d468c);
}

.edin-sidebar-list-item.active .lottie img{
    box-shadow: 0 0 6px 4px rgba(255,255,255,0.9);
    background: white;
    border-radius: 50%;
}

    /* Base Container */
.ai-workspace-container {
    height:100%;
    display: flex;
    flex-direction: column;
    animation: pageLoad 0.6s ease-out;
    overflow: hidden;
}

/* Page load entrance */
@keyframes pageLoad {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Staggered entrance for child panels */
.ai-config-panel {
    animation: panelSlideIn 0.5s ease-out 0.1s both;
}
.ai-output-panel {
    animation: panelSlideIn 0.5s ease-out 0.25s both;
}
@keyframes panelSlideIn {
    0% { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Stagger form sections inside config */
.ai-config-panel .ai-form-section:nth-child(1) { animation: formFadeIn 0.4s ease-out 0.2s both; }
.ai-config-panel .ai-form-section:nth-child(2) { animation: formFadeIn 0.4s ease-out 0.3s both; }
.ai-config-panel .ai-form-section:nth-child(3) { animation: formFadeIn 0.4s ease-out 0.4s both; }
.ai-config-panel .ai-form-section:nth-child(4) { animation: formFadeIn 0.4s ease-out 0.5s both; }
.ai-config-panel .ai-form-section:nth-child(5) { animation: formFadeIn 0.4s ease-out 0.6s both; }
@keyframes formFadeIn {
    0% { opacity: 0; transform: translateX(-10px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* Header */
.ai-header {
    padding: 24px 40px;
    border-bottom: 1px solid #eee;
}

.ai-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.ai-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111;
    margin: 0;
}

.ai-header-subtitle {
    color: #666;
}
.ai-tool-nav{
    flex: 0;
}
/* Tool Tabs */
.ai-tool-tabs {
    display: flex;
    gap: 8px;
}

.ai-tool-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: transparent;
    color: #555;
    font-weight: 500;
}

.ai-tool-tab:hover {
    background: #f5f5f5;
}

.ai-tool-tab.active {
    background: #6d468c;
    color: #fff;
}

.ai-tool-tab i {
    font-size: 1rem;
}

.ai-tool-tab.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ai-tool-tab.disabled:hover {
    background: transparent;
}

.ai-tool-tab .coming-soon {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-tool-tab.active .coming-soon {
    background: rgba(255,255,255,0.2);
}

/* Main Content */
.ai-main {
    display: flex;
    flex:1;
    height: 100%;
    overflow: auto;
    gap: 18px;
}

/* Left Panel - Config */
.ai-config-panel {
    flex: 0 0 540px;
    width: 540px;
    max-width: 540px;
    min-width: 540px;
    width:33%;
    border-right: 2px solid #e5e7eb;
    background: #fff;
    border-radius:12px;
}

/* Right Panel - Output */
.ai-output-panel {
    flex: 1;
    width: 0;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
}

/* Form Sections */
.ai-form-section {
    margin-bottom: 28px;
}

.ai-form-section:last-child {
    margin-bottom: 0;
}

.ai-form-label {

    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: block;
}

/* Dropdowns Row */
.ai-dropdowns {
    display: flex;
    gap: 12px;
    width: 100%;
}

.ai-dropdown-wrapper {
    flex: 1;
    min-width: 0;
}

.ai-dropdown-wrapper label {
    display: block;
    color: #888;
    margin-bottom: 6px;
}

/* Custom Dropdown Styles */
.ai-custom-dropdown {
    position: relative;
}

.ai-dropdown-trigger {
    width: 100%;
    padding: 10px 32px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.15s ease;
    background: #fff;
    cursor: pointer;
    display: block;
    min-height: 40px;
    text-align: left;
    overflow: hidden;
    position: relative;
}

.ai-dropdown-trigger:hover {
    border-color: #bbb;
}

.ai-dropdown-trigger.open {
    border-color: #6d468c;
    box-shadow: 0 0 0 2px rgba(109,70,140,0.1);
}

.ai-dropdown-trigger.disabled {
    background: #f9f9f9;
    cursor: not-allowed;
    color: #bbb;
}

.ai-dropdown-trigger .placeholder {
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    padding-right: 20px;
}

.ai-dropdown-trigger .selected-text {
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    padding-right: 20px;
}

.ai-dropdown-trigger .arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;

    transition: transform 0.15s ease;
}

.ai-dropdown-trigger.open .arrow {
    transform: translateY(-50%) rotate(180deg);
}

.ai-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ai-dropdown-menu .dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.ai-dropdown-menu .dropdown-item:hover {
    background: #f5f5f5;
}

.ai-dropdown-menu .dropdown-item.selected {
    background: #6d468c;
    color: #fff;
}

.ai-dropdown-menu .no-options {
    padding: 12px;
    color: #aaa;
    text-align: center;
}

/* Standards List */
.ai-standards-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 12px;
}

.ai-standard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8f8f8;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ai-standard-item:hover {
    background: #f0f0f0;
}

.ai-standard-item .code {
    font-weight: 600;
    color: #6d468c;
    color: var(--primary)
}

.ai-standard-item .desc {
    color: #666;
    line-height: 1.4;
}

.ai-standard-item .add-btn {
    /*background: #3b82f6;*/
    border: none;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.ai-standard-item .add-btn:hover {
    background: #5a3775;
}

/* Selected Standards */
.ai-selected-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.ai-selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ai-selected-header span {
    font-weight: 600;
    color: #333;
}

.ai-selected-count {
    color: #666;
    background: #eee;
    padding: 2px 8px;
    border-radius: 10px;
}

.ai-selected-standards {
    max-height: 120px;
    overflow-y: auto;
}

.ai-selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: #f3eef7;
    border-radius: 6px;
    margin-bottom: 6px;
    border: 1px solid #e0d1ec;
}

.ai-selected-item .code {
    font-weight: 600;
    color: #6d468c;
    color: var(--primary);
}

.ai-selected-item .desc {
    color: #666;
}

.ai-selected-item .remove-btn,
.ai-file-item .remove-btn {
    background: none;
    border: none;
    color: #999;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.ai-selected-item .remove-btn:hover,
.ai-file-item .remove-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ============================================ */
/* Template Selection Cards                     */
/* ============================================ */

.ai-template-cards {
    display: flex;
    gap: 12px;
}

.ai-template-card {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.ai-template-card:hover {
    border-color: #bbb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.ai-template-card.selected {
    border-color: var(--primary, #6d468c);
    box-shadow: 0 0 0 1px var(--primary, #6d468c), 0 2px 8px rgba(109,70,140,0.15);
}

.ai-template-card-header {
    padding: 14px 12px;
    text-align: center;
    color: #fff;
}

.ai-template-card-header i {
    font-size: 1.4rem;
}

.ai-template-card-body {
    padding: 10px 12px 6px;
    flex: 1;
}

.ai-template-card-name {
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.ai-template-card-desc {
    color: #6b7280;
    font-size: 0.72rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-template-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.ai-template-feature {
    font-size: 0.65rem;
    background: #f3f4f6;
    color: #6b7280;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.ai-template-card.selected .ai-template-feature {
    background: #f3eef7;
    color: var(--primary, #6d468c);
}

.ai-template-card-actions {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f3f4f6;
}

.ai-template-preview-btn {
    background: none;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-template-preview-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

.ai-template-selected-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary, #6d468c);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}

/* ============================================ */
/* Template Preview Modal                       */
/* ============================================ */

.ai-preview-overlay {
    z-index: 10001;
}

.ai-preview-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-preview-modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-preview-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-preview-modal-title i {
    font-size: 1.2rem;
}

.ai-preview-modal-title h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.ai-preview-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-preview-select-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    color: #fff;
}

.ai-preview-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f3f4f6;
    border: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    font-size: 1rem;
}

.ai-preview-close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.ai-preview-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f9fafb;
}

.ai-preview-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.ai-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #9ca3af;
}

.ai-preview-loading i {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.ai-preview-modal-footer {
    padding: 12px 24px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.ai-preview-footer-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Upload Zone */
.ai-upload-zone {
    border: 2px dashed #d1c4e0;
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    background: #faf8fc;
    transition: all 0.25s ease;
    cursor: pointer;
}
.ai-upload-zone:hover {
    border-color: #6d468c;
    background: #f3eef7;
}
.ai-upload-zone--dragover {
    border-color: #6d468c;
    background: #ede5f5;
    transform: scale(1.01);
    box-shadow: 0 0 0 4px rgba(109, 70, 140, 0.1);
}
.ai-upload-icon {
    font-size: 2rem;
    color: #6d468c;
    margin-bottom: 8px;
    display: block;
}
.ai-upload-text {
    font-weight: 600;
    color: #6d468c;
    margin: 4px 0 2px;
}
.ai-upload-subtext {
    color: #999;
    font-size: 0.85rem;
    margin: 0;
}
.ai-upload-formats {
    color: #bbb;
    font-size: 0.75rem;
    margin: 8px 0 0;
    letter-spacing: 0.3px;
}

.ai-file-list {
    margin-top: 12px;
}

.ai-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f8f8;
    border-radius: 6px;
    margin-bottom: 6px;
}

.ai-file-item .file-name {
    color: #333;
}

.ai-file-item .file-size {
    color: #999;
    margin-left: 8px;
}

/* Textarea */
.ai-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.15s ease;
    font-family: inherit;
}

.ai-textarea:focus {
    outline: none;
    border-color: #6d468c;
    box-shadow: 0 0 0 2px rgba(109,70,140,0.1);
}

.ai-textarea::placeholder {
    color: #bbb;
}

/* Generate Button */
.ai-generate-btn {
    width: 100%;
    background: linear-gradient(135deg, #6d468c, #8b5fbf);
    border: none;
    color: #fff;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
    box-shadow: 0 4px 15px rgba(109, 70, 140, 0.3);
}

.ai-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a3775, #7a4fad);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(109, 70, 140, 0.4);
}

.ai-generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.ai-generate-lotty-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}
.ai-working-dots {
    animation: workingDots 1.5s ease-in-out infinite;
}
@keyframes workingDots {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.ai-reset-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    color: #888;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
}

.ai-reset-link:hover {
    color: #555;
}

/* Output Panel */
.ai-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.ai-output-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.ai-copy-btn {
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-copy-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

/* Output Empty */
.ai-output-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #bbb;
    position: relative;
    min-height: 300px;
    padding: 40px 20px;
}

.ai-output-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.ai-output-empty p {
}

/* Output Content */
.ai-output-content {
    /*flex: 1;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;*/
}

.ai-editor-wrapper {
    flex: 1;
    min-width: 0;
}

.ai-editor-wrapper #multi-input {
    width: 100%;
}

.ai-editor-wrapper .fr-box {
    min-height: 300px;
}

.ai-editor-wrapper .fr-wrapper {
    min-height: 250px;
}

/* Streaming Preview */
.ai-streaming-preview {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    overflow-anchor: none;
}

.ai-streaming-preview img {
    /* Prevent images from causing layout shifts while loading */
    max-width: 100%;
    height: auto;
}

/* Output Loading */
.ai-output-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ai-output-loading i {
    font-size: 2rem;
    color: #6d468c;
    margin-bottom: 16px;
}

.ai-output-loading p {
    color: #666;
}

/* Empty State */
.ai-empty-state {
    text-align: center;
    padding: 20px;
    color: #aaa;
}

.ai-empty-state i {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

/* Badge */
.ai-badge {

    color: #666;
    background: #eee;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Spinner */
.ai-loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Feedback Section */
.ai-feedback-section {
    margin-top: 16px;
    padding: 18px;
    border-top: 1px solid #eee;
}

.ai-feedback-input-row {
    display: flex;
    gap: 8px;
}

.ai-feedback-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    transition: border-color 0.15s ease;
}

.ai-feedback-input:focus {
    outline: none;
    border-color: #6d468c;
}

.ai-feedback-input::placeholder {
    color: #bbb;
}

.ai-feedback-input:disabled {
    background: #f9f9f9;
    cursor: not-allowed;
}

.ai-feedback-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #6d468c;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.ai-feedback-btn:hover:not(:disabled) {
    background: #5a3775;
}

.ai-feedback-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mode Toggle */
.ai-mode-toggle {
    display: flex;
    gap: 2px;
    background: #f0f0f0;
    padding: 3px;
    border-radius: 6px;
    flex-shrink: 0;
}

.ai-mode-btn {
    padding: 6px 10px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    color: #888;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-mode-btn:hover:not(.active) {
    background: #e5e5e5;
}

.ai-mode-btn.active {
    background: #fff;
    color: #333;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ai-mode-btn.active.smart-mode {
    color: #7c3aed;
}

.ai-mode-btn.active.fast-mode {
    color: #059669;
}

/* Feedback History */
.ai-feedback-history {
    max-height: 100px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.ai-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 6px;
    color: #555;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ai-history-item:hover {
    background: #eee;
}

.ai-history-item i {
    color: #aaa;

}

.ai-history-item span {
    flex: 1;
}

.ai-history-item .ai-revert-icon {
    opacity: 0;
    color: #888;
}

.ai-history-item:hover .ai-revert-icon {
    opacity: 1;
}

.ai-history-item.ai-history-initial {
    background: #f3eef7;
}

.ai-history-item.ai-history-initial i:first-child {
    color: #6d468c;
}

/* Placeholder Content */
.ai-placeholder-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    text-align: center;
}

.ai-placeholder-content i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 16px;
}

.ai-placeholder-content h3 {
    color: #999;
    font-weight: 500;
    margin-bottom: 8px;
}

.ai-placeholder-content p {
    color: #bbb;
}

/* Module Content */
.ai-module-content {
    display: none;
}

.ai-module-content.active {
    display: flex;
    flex: 1;
    gap: 18px;
    height: 100%;
}

/* Modal */
.ai-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.ai-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
}

.ai-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-modal-header i {
    color: #f59e0b;
    font-size: 1.2rem;
}

.ai-modal-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.ai-modal-body {
    padding: 20px;
}

.ai-modal-body p {
    margin: 0 0 12px 0;
    color: #555;
    line-height: 1.5;
}

.ai-modal-body .ai-revert-text {
    background: #f5f5f5;
    padding: 10px 12px;
    border-radius: 6px;
    color: #333;
}

.ai-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ai-modal-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease;
}

.ai-modal-btn-cancel {
    background: #f0f0f0;
    color: #555;
}

.ai-modal-btn-cancel:hover {
    background: #e5e5e5;
}

.ai-modal-btn-confirm {
    background: #ef4444;
    color: #fff;
}

.ai-modal-btn-confirm:hover {
    background: #dc2626;
}

/* Responsive */
@media (max-width: 992px) {
    .ai-main {
        flex-direction: column;
    }
    .ai-config-panel {
        flex: none;
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    .ai-tool-tabs {
        flex-wrap: wrap;
    }
}

/* ============================================ */
/* Response Analysis Module                     */
/* ============================================ */

.ra-container {
    flex: 1;
    width: 100%;
    /*background: #f0f2f5;*/
    padding: 28px 32px;
    overflow-y: auto;

}

.ra-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

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

.ra-header-left i {
    font-size: 1rem;
    color: #6b7280;
}

.ra-title {
    font-weight: 700;
    color: #374151;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.ra-filters-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ra-filter-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ra-filter-group label {

    font-weight: 600;
    color: #6b7280;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ra-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.ra-search-input {
    width: 100%;
    padding: 8px 14px 8px 32px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;

    color: #374151;
    outline: none;
    min-height: 36px;
    transition: border-color 0.15s ease;
}

.ra-search-input:focus {
    border-color: #6d468c;
    box-shadow: 0 0 0 2px rgba(109,70,140,0.1);
}

.ra-search-input::placeholder {
    color: #9ca3af;
}

.ra-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;

    pointer-events: none;
}

.ra-search-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;

}

.ra-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.ra-search-results .ra-menu-item .ra-student-school {

    color: #9ca3af;
    margin-left: 8px;
    flex-shrink: 0;
    white-space: nowrap;
}



/* RA Dropdowns */
.ra-dropdown {
    position: relative;
}

.ra-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;

    color: #374151;
    cursor: pointer;
    min-width: 160px;
    max-width: 220px;
    transition: border-color 0.15s ease;
}

.ra-dropdown-trigger:hover {
    border-color: #9ca3af;
}

.ra-dropdown-trigger.disabled {
    background: #f9fafb;
    cursor: not-allowed;
    color: #9ca3af;
}

.ra-dropdown-trigger .ra-trigger-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ra-dropdown-trigger .ra-arrow {
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.ra-dropdown-trigger.open .ra-arrow {
    transform: rotate(180deg);
}

.ra-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.ra-menu-item {
    padding: 10px 14px;

    cursor: pointer;
    transition: background 0.1s ease;
    color: #374151;
}

.ra-menu-item:hover {
    background: #f3f4f6;
}

.ra-menu-item.selected {
    background: #f3eef7;
    color: #5a3775;
}

.ra-menu-empty {
    padding: 14px;
    color: #9ca3af;
    text-align: center;

}

/* Analyze Button */
.ra-analyze-btn-group {
    display: flex;
    position: relative;
}

.ra-analyze-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 8px 0 0 8px;

    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ra-analyze-btn:hover:not(:disabled) {
    background: #047857;
}

.ra-analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ra-analyze-split-btn {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: #059669;
    color: #fff;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.25);
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ra-analyze-split-btn:hover {
    background: #047857;
}

.ra-submissions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 280px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.ra-submissions-menu .ra-menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ra-sub-date {
    color: #9ca3af;

    flex-shrink: 0;
    margin-left: 12px;
}

/* Stats Row */
.ra-stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.ra-stat-card {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
}

.ra-stat-card.green-bg {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: transparent;
}

.ra-stat-card.red-bg {
    background: linear-gradient(135deg, #f87171, #dc2626);
    border-color: transparent;
}

.ra-stat-card.red-bg .ra-stat-value,
.ra-stat-card.red-bg .ra-stat-label {
    color: #fff;
}

.ra-stat-card.red-bg .ra-stat-label {
    color: rgba(255,255,255,0.85);
}

.ra-stat-card.gray-bg {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.ra-stat-card.risk-medium {
    border-color: #f59e0b;
}

.ra-stat-card.risk-medium .ra-stat-value {
    color: #d97706;
}

.ra-stat-card.risk-high {
    border-color: #ef4444;
}

.ra-stat-card.risk-high .ra-stat-value {
    color: #dc2626;
}

.ra-stat-card.risk-low .ra-stat-value {
    color: #059669;
}

.ra-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.ra-stat-card.green-bg .ra-stat-value {
    color: #fff;
}

.ra-stat-label {
    font-weight: 600;
    color: #9ca3af;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 6px;
}

.ra-stat-card.green-bg .ra-stat-label {
    color: rgba(255,255,255,0.85);
}

/* Sections */
.ra-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
}

.ra-section:last-child {
    margin-bottom: 0;
}

.ra-section-title {

    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ra-section-title i {

}

/* Score Trend Chart */
.ra-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 170px;
    padding: 0 10px;
}

.ra-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 90px;
}

.ra-bar-label {

    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.ra-bar {
    width: 160px;
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.6s ease;
}

.ra-bar-month {

    color: #9ca3af;
    margin-top: 10px;
    font-weight: 500;
}

.ra-bar-month.current {
    color: #059669;
    font-weight: 700;
}

/* Similarity Check */
.ra-check-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid #f3f4f6;
}

.ra-check-item:first-child {
    padding-top: 0;
}

.ra-check-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ra-check-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

}

.ra-check-icon.pass {
    background: #d1fae5;
    color: #059669;
}

.ra-check-icon.fail {
    background: #fee2e2;
    color: #dc2626;
}

.ra-check-icon.info {
    background: #e0d1ec;
    color: #5a3775;
}

.ra-check-text h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 3px 0;
}

.ra-check-text p {

    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* Growth Areas */
.ra-growth-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid #f3f4f6;
}

.ra-growth-item:first-child {
    padding-top: 0;
}

.ra-growth-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ra-growth-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

}

.ra-growth-icon.up {
    background: #d1fae5;
    color: #059669;
}

.ra-growth-icon.down {
    background: #fee2e2;
    color: #dc2626;
}

.ra-growth-icon.neutral {
    background: #f3f4f6;
    color: #9ca3af;
}

.ra-growth-text h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 3px 0;
}

.ra-growth-text p {

    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* RA Empty / Loading States */
.ra-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
}

.ra-empty-state i {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 16px;
}

.ra-empty-state h3 {
    color: #6b7280;
    font-weight: 500;
    font-size: 1.1rem;
    margin: 0 0 8px 0;
}

.ra-empty-state p {
    color: #9ca3af;
    font-size: 0.9rem;
    margin: 0;
}

@media (max-width: 768px) {
    .ra-container {
        padding: 20px 16px;
    }
    .ra-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .ra-filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    .ra-stats-row {
        flex-wrap: wrap;
    }
    .ra-stat-card {
        min-width: calc(50% - 12px);
    }
    .ra-chart {
        height: 140px;
    }
    .ra-bar {
        width: 40px;
    }
}

/* ============================================ */
/* Suggestion Chips                             */
/* ============================================ */
.ai-suggestions {
    margin-top: 10px;
}

/* Lesson Length Toggle */
.ai-length-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}
.ai-length-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 6px;
    border: 1.5px solid #e0d1ec;
    border-radius: 8px;
    background: #fff;
    color: #6d468c;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ai-length-btn:hover {
    background: #f3eef7;
    border-color: #6d468c;
}
.ai-length-btn.active {
    background: #6d468c;
    color: #fff;
    border-color: #6d468c;
    box-shadow: 0 2px 8px rgba(109, 70, 140, 0.25);
}
.ai-length-btn i {
    font-size: 0.85rem;
}
.ai-length-hint {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.7;
}

.ai-suggestions-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 8px;
}
.ai-suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ai-suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid #e0d1ec;
    border-radius: 20px;
    background: #fff;
    color: #6d468c;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}
.ai-suggestion-chip:hover {
    background: #f3eef7;
    border-color: #6d468c;
}
.ai-suggestion-chip i {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* ============================================ */
/* Lotty Chat Bubble (Empty State)              */
/* ============================================ */
.ai-lotty-intro {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 400px;
}
.ai-lotty-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ai-lotty-bubble {
    background: #f3eef7;
    border-radius: 0 16px 16px 16px;
    padding: 14px 18px;
    color: #4a2d66;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(109, 70, 140, 0.1);
}
.ai-lotty-bubble p {
    margin: 0;
}

/* ============================================ */
/* Generating Progress Bar                      */
/* ============================================ */
.ai-generating-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #f3eef7, #ede5f5);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 12px;
}
.ai-generating-steps {
    display: flex;
    gap: 16px;
    align-items: center;
}
.ai-gen-step {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: #999;
    font-weight: 500;
}
.ai-gen-step.active {
    color: #6d468c;
    font-weight: 600;
}
.ai-gen-step.done {
    color: #22c55e;
}
.ai-gen-step i {
    font-size: 0.55rem;
}

/* ============================================ */
/* Water / Bubble Animations (Lotty)            */
/* ============================================ */

/* Lotty avatar pulse glow */
.ai-lotty-avatar {
    animation: lottyFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(109, 70, 140, 0.3));
}
@keyframes lottyFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Lotty intro container with floating bubbles */
.ai-lotty-intro {
    position: relative;
}
.ai-lotty-intro::before,
.ai-lotty-intro::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(109, 70, 140, 0.08);
    animation: bubbleFloat 4s ease-in-out infinite;
}
.ai-lotty-intro::before {
    width: 14px;
    height: 14px;
    top: -10px;
    left: 10px;
    animation-delay: 0s;
}
.ai-lotty-intro::after {
    width: 8px;
    height: 8px;
    top: -5px;
    right: 30px;
    animation-delay: 1.5s;
    animation-duration: 3s;
}
@keyframes bubbleFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.6; }
    50% { transform: translateY(-12px) scale(1.15); opacity: 1; }
}

/* Generate button active state while generating */
.ai-generate-btn:disabled {
    opacity: 0.85;
    background: linear-gradient(135deg, #5a3775, #7a4fad);
}

/* Progress bar — water wave effect (from Axol, purple palette) */
.ai-generating-bar {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(90deg,
            rgba(243,238,247,0.0) 0%,
            rgba(224,209,236,0.5) 20%,
            rgba(189,162,215,0.4) 40%,
            rgba(139,95,191,0.3) 55%,
            rgba(189,162,215,0.4) 70%,
            rgba(224,209,236,0.5) 85%,
            rgba(243,238,247,0.0) 100%
        );
    background-size: 250% 100%;
    animation: lottySwimShimmer 2.5s ease-in-out infinite;
}

/* Water wave overlay — two crossing sine waves */
.ai-generating-bar::before {
    content: '';
    position: absolute;
    top: 0; left: -20%; right: -20%; bottom: 0;
    background:
        repeating-linear-gradient(
            100deg,
            transparent 0px,
            rgba(255,255,255,0.18) 4px,
            transparent 8px
        );
    animation: lottyWaveSlide 1.8s linear infinite;
    pointer-events: none;
}
.ai-generating-bar::after {
    content: '';
    position: absolute;
    top: 0; left: -20%; right: -20%; bottom: 0;
    background:
        repeating-linear-gradient(
            80deg,
            transparent 0px,
            rgba(255,255,255,0.12) 6px,
            transparent 12px
        );
    animation: lottyWaveSlide 2.5s linear infinite reverse;
    pointer-events: none;
}

/* Keep step text above the waves */
.ai-generating-steps {
    position: relative;
    z-index: 1;
}

@keyframes lottySwimShimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
@keyframes lottyWaveSlide {
    from { transform: translateX(0); }
    to   { transform: translateX(20px); }
}

/* Streaming content — no per-element animation to avoid flash on reflow */

/* Generate button Lotty icon pulse while idle */
.ai-generate-lotty-icon {
    animation: lottyIconPulse 2s ease-in-out infinite;
}
@keyframes lottyIconPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 6px rgba(255,255,255,0.4)); }
}

/* Working dots animation - individual dot stagger */
.ai-working-dots {
    letter-spacing: 2px;
    animation: none;
}

/* Lotty bubble subtle entrance */
.ai-lotty-bubble {
    animation: bubbleAppear 0.6s ease-out;
}
@keyframes bubbleAppear {
    0% { opacity: 0; transform: scale(0.9) translateX(-8px); }
    100% { opacity: 1; transform: scale(1) translateX(0); }
}

/* Floating bubble scene behind Lotty intro */
.ai-lotty-scene {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.ai-lotty-bubble-bg {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(109, 70, 140, 0.06) 0%, rgba(109, 70, 140, 0.02) 70%, transparent 100%);
    animation: bgBubbleFloat linear infinite;
}
.ai-bubble-1 { width: 60px; height: 60px; left: 10%; bottom: -60px; animation-duration: 8s; animation-delay: 0s; }
.ai-bubble-2 { width: 35px; height: 35px; left: 30%; bottom: -35px; animation-duration: 6s; animation-delay: 1s; }
.ai-bubble-3 { width: 45px; height: 45px; left: 55%; bottom: -45px; animation-duration: 9s; animation-delay: 2s; }
.ai-bubble-4 { width: 25px; height: 25px; left: 75%; bottom: -25px; animation-duration: 7s; animation-delay: 0.5s; }
.ai-bubble-5 { width: 50px; height: 50px; left: 85%; bottom: -50px; animation-duration: 10s; animation-delay: 3s; }
@keyframes bgBubbleFloat {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    10% { opacity: 0.6; }
    50% { transform: translateY(-50vh) scale(1); opacity: 0.4; }
    100% { transform: translateY(-100vh) scale(0.8); opacity: 0; }
}

/* ==========================================
   Component Library
   ========================================== */

/* Toggle bar */
.cl-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f9f9fc;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.cl-toggle-bar:hover {
    border-color: #6d468c;
    background: #f3eef7;
}
.cl-toggle-bar i {
    color: #6d468c;
    font-size: 12px;
    transition: transform 0.2s ease;
}
.cl-toggle-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cl-toggle-text {
    font-size: 13px;
    font-weight: 500;
    color: #444;
}
.cl-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    background: #6d468c;
    color: #fff;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Selected component chips (collapsed view) */
.cl-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.cl-selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f3eef7;
    border: 1px solid #d9cce6;
    border-radius: 16px;
    font-size: 12px;
    animation: clChipIn 0.2s ease;
}
.cl-chip-type {
    color: #6d468c;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.cl-chip-name {
    color: #444;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cl-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: rgba(109, 70, 140, 0.15);
    color: #6d468c;
    border-radius: 50%;
    cursor: pointer;
    font-size: 9px;
    transition: all 0.15s ease;
}
.cl-chip-remove:hover {
    background: #6d468c;
    color: #fff;
}

@keyframes clChipIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Browser panel */
.cl-browser {
    margin-top: 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    animation: clBrowserOpen 0.25s ease;
}
@keyframes clBrowserOpen {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 600px; }
}

/* Search row */
.cl-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}
.cl-search-input-wrap {
    position: relative;
    flex: 1;
}
.cl-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 12px;
}
.cl-search-input {
    width: 100%;
    padding: 7px 10px 7px 30px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease;
}
.cl-search-input:focus {
    border-color: #6d468c;
}
.cl-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: none;
    background: #f3eef7;
    color: #6d468c;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}
.cl-clear-btn:hover {
    background: #e6d9f0;
}

/* Filter rows */
.cl-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
}
.cl-filter-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    flex-shrink: 0;
}
.cl-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.cl-filter-pill {
    padding: 3px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    color: #666;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.cl-filter-pill:hover {
    border-color: #6d468c;
    color: #6d468c;
}
.cl-filter-pill.active {
    background: #6d468c;
    border-color: #6d468c;
    color: #fff;
}

/* Component grid */
.cl-grid {
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
}
.cl-grid::-webkit-scrollbar {
    width: 5px;
}
.cl-grid::-webkit-scrollbar-thumb {
    background: #d9cce6;
    border-radius: 4px;
}

/* Component card */
.cl-card {
    border: 1.5px solid transparent;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.15s ease;
    background: #fafafa;
}
.cl-card:hover {
    background: #f3eef7;
    border-color: #e6d9f0;
}
.cl-card.selected {
    background: #f3eef7;
    border-color: #6d468c;
}
.cl-card-body {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
}
.cl-card-check {
    flex-shrink: 0;
    font-size: 16px;
    color: #ccc;
    transition: color 0.15s ease;
}
.cl-card.selected .cl-card-check {
    color: #6d468c;
}
.cl-card-info {
    flex: 1;
    min-width: 0;
}
.cl-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cl-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.cl-card-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6d468c;
    background: rgba(109, 70, 140, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
}
.cl-card-cat {
    font-size: 10px;
    color: #999;
}
.cl-card-preview-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #888;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s ease;
}
.cl-card-preview-btn:hover {
    border-color: #6d468c;
    color: #6d468c;
    background: #f3eef7;
}

/* ==========================================
   Component Quick Preview Modal
   ========================================== */

.cl-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: clOverlayIn 0.15s ease;
}
@keyframes clOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cl-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    width: 92%;
    max-width: 680px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: clModalIn 0.2s ease;
}
@keyframes clModalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.cl-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.cl-modal-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.cl-modal-name {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cl-preview-type-badge {
    display: inline-block;
    padding: 2px 10px;
    background: #f3eef7;
    color: #6d468c;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.cl-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    background: #f3f4f6;
    color: #666;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.cl-modal-close:hover {
    background: #e5e7eb;
    color: #333;
}

.cl-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}
.cl-modal-html {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
}
.cl-modal-html img {
    max-width: 100%;
    height: auto;
}

.cl-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 20px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.cl-modal-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 22px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    background: linear-gradient(135deg, #6d468c 0%, #8b5fbf 100%);
    color: #fff;
}
.cl-modal-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(109, 70, 140, 0.35);
}
.cl-modal-action-btn--remove {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}
.cl-modal-action-btn--remove:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}
