/* ==================== MESSAGE ACTION BAR ==================== */
/* Force message wrappers to stack bubble + actions vertically */
.message-wrapper {
    flex-direction: column;
}
.message-wrapper[data-is-user="true"] {
    align-items: flex-end;
}
.message-wrapper[data-is-user="false"] {
    align-items: flex-start;
}
.msg-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
    padding-left: 2px;
}
.msg-actions-right {
    justify-content: flex-end;
    padding-right: 2px;
    padding-left: 0;
}
.msg-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.12s ease;
    padding: 0;
    font-family: inherit;
    outline: none;
}
.msg-action-btn:hover {
    background: #f1f5f9;
    color: #475569;
}
.msg-action-btn:active {
    background: #e2e8f0;
}
.msg-action-btn.active {
    color: #22c55e;
}
.msg-action-btn.feedback-given {
    color: #94a3b8;
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

/* ==================== COPY BUTTON ==================== */
.msg-action-btn .icon-check {
    display: none;
}
.msg-action-btn.copied .icon-copy {
    display: none;
}
.msg-action-btn.copied .icon-check {
    display: block;
    color: #22c55e;
}

/* ==================== FEEDBACK MODAL ==================== */
.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.15s ease;
}
.feedback-modal {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    width: 280px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.feedback-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.feedback-modal-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}
.feedback-modal-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    font-size: 16px;
}
.feedback-modal-close:hover {
    background: #f1f5f9;
    color: #475569;
}
.feedback-rating-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 14px;
}
.feedback-rating-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-family: inherit;
}
.feedback-rating-btn:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}
.feedback-rating-btn.selected {
    border-color: #3b82f6;
    background: #3b82f6;
    color: #fff;
}
.feedback-textarea {
    width: 100%;
    min-height: 60px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    font-family: inherit;
    color: #334155;
    resize: vertical;
    outline: none;
    margin-bottom: 14px;
    box-sizing: border-box;
}
.feedback-textarea:focus {
    border-color: #93c5fd;
}
.feedback-textarea::placeholder {
    color: #94a3b8;
}
.feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.feedback-cancel-btn {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.feedback-cancel-btn:hover {
    background: #f8fafc;
}
.feedback-submit-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease;
}
.feedback-submit-btn:hover {
    background: #2563eb;
}
.feedback-submit-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* ==================== EDIT BANNER ==================== */
.edit-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 6px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 11.5px;
    color: #92400e;
}
.edit-banner-icon {
    flex-shrink: 0;
    color: #d97706;
}
.edit-banner-text {
    flex: 1;
    font-weight: 600;
}
.edit-banner-cancel {
    padding: 2px 10px;
    border: 1px solid #fde68a;
    border-radius: 6px;
    background: #fff;
    color: #92400e;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.edit-banner-cancel:hover {
    background: #fef3c7;
}

/* ==================== REPLY / QUOTE ==================== */
.quote-reply-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 6px;
    background: #f8fafc;
    border-left: 3px solid #3b82f6;
    border-radius: 0 8px 8px 0;
    font-size: 11.5px;
    color: #475569;
}
.quote-reply-icon {
    flex-shrink: 0;
    color: #3b82f6;
}
.quote-reply-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
}
.quote-reply-clear {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}
.quote-reply-clear:hover {
    background: #e2e8f0;
    color: #475569;
}

/* Quoted text display in message history */
.msg-quoted-text {
    padding: 6px 10px;
    margin-bottom: 6px;
    background: #f8fafc;
    border-left: 3px solid #cbd5e1;
    border-radius: 0 6px 6px 0;
    font-size: 11px;
    color: #64748b;
    font-style: italic;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Selection popup */
.selection-popup {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 9998;
    animation: fadeIn 0.1s ease;
}
.selection-popup-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.selection-popup-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}
.selection-popup-divider {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
}

/* ==================== DICTATION / MIC ==================== */
.mic-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}
.mic-btn:hover {
    background: #f1f5f9;
    color: #475569;
}

/* Dictation overlay — replaces input row during recording */
.dictation-overlay {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    min-height: 40px;
}
.dictation-overlay.hidden {
    display: none;
}

/* Cancel button (X) — light grey circle */
.dictation-cancel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s ease;
}
.dictation-cancel-btn:hover {
    background: #e2e8f0;
}

/* Accept button (checkmark) — dark charcoal circle */
.dictation-accept-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #1e293b;
    color: #ffffff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s ease;
}
.dictation-accept-btn:hover {
    background: #334155;
}

/* Wave visualization container */
.dictation-wave-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 32px;
    overflow: hidden;
}

/* Individual wave bar */
.wave-bar {
    display: inline-block;
    width: 3px;
    height: 3px;
    min-height: 3px;
    background: #1e293b;
    border-radius: 2px;
    transition: height 0.05s ease;
}

/* Live transcript overlay during recording */
.dictation-live-transcript {
    position: absolute;
    bottom: -18px;
    left: 40px;
    right: 40px;
    font-size: 10px;
    color: #64748b;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* Transcribing state (bouncing dots) */
.dictation-transcribing {
    display: flex;
    align-items: center;
    gap: 6px;
}
.transcribing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #475569;
    animation: transcribeBounce 1.2s ease-in-out infinite;
}
@keyframes transcribeBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}
.transcribing-text {
    font-size: 11px;
    color: #475569;
    font-weight: 600;
    margin-left: 4px;
}

/* ==================== PROMPT LIBRARY PANEL ==================== */
.prompt-lib-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.prompt-lib-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #f1f5f9;
    padding: 0 16px;
    flex-shrink: 0;
}
.prompt-lib-tab {
    padding: 8px 14px;
    font-size: 11.5px;
    font-weight: 600;
    color: #94a3b8;
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.12s ease;
    font-family: inherit;
}
.prompt-lib-tab:hover {
    color: #475569;
}
.prompt-lib-tab.active {
    color: #1e293b;
    border-bottom-color: #64748b;
}
.prompt-lib-search {
    padding: 8px 16px;
    flex-shrink: 0;
}
.prompt-lib-search input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
    color: #334155;
    outline: none;
    box-sizing: border-box;
}
.prompt-lib-search input:focus {
    border-color: #93c5fd;
}
.prompt-lib-search input::placeholder {
    color: #94a3b8;
}
.prompt-lib-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 16px;
}
.prompt-lib-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    margin-bottom: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: #64748b;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}
.prompt-lib-back:hover {
    color: #334155;
}

/* Category row */
.prompt-cat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.12s ease;
}
.prompt-cat-row:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}
.prompt-cat-icon {
    color: #94a3b8;
    flex-shrink: 0;
}
.prompt-cat-name {
    flex: 1;
    font-size: 12.5px;
    font-weight: 600;
    color: #1e293b;
}
.prompt-cat-count {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 10px;
}
.prompt-cat-chevron {
    color: #cbd5e1;
    flex-shrink: 0;
}

/* Prompt item row */
.prompt-item-row {
    padding: 10px 12px;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.12s ease;
}
.prompt-item-row:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}
.prompt-item-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}
.prompt-item-desc {
    font-size: 11px;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Prompt preview */
.prompt-preview-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}
.prompt-preview-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 12px;
}
.prompt-preview-template {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    font-size: 11.5px;
    color: #334155;
    line-height: 1.6;
    max-height: 250px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 12px;
}
.prompt-preview-vars {
    margin-bottom: 14px;
}
.prompt-preview-var-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #94a3b8;
    margin-bottom: 6px;
}
.prompt-var-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    margin-right: 4px;
    margin-bottom: 4px;
}
.prompt-use-btn {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: #1e293b;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease;
}
.prompt-use-btn:hover {
    background: #334155;
}

/* Empty & loading states */
.prompt-lib-empty {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
    font-size: 12px;
}
.prompt-lib-loading {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
    font-size: 12px;
}

/* ==================== UTILITY ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
