/* =============================================
   智能回复工具 - 样式文件
   ============================================= */

/* ---- 主容器 ---- */
.ir-container {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    min-height: 680px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.ir-container.is-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    border-radius: 0;
    border: none;
    min-height: 100vh;
}

/* ---- 工具栏 ---- */
.ir-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ir-toolbar .toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ir-toolbar .toolbar-group + .toolbar-group {
    padding-left: 8px;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
}

.ir-toolbar-title {
    flex: 1;
    justify-content: center;
    border-left: none !important;
    border-right: none !important;
}

.toolbar-title-text {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    letter-spacing: 0.5px;
}

.ir-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    font-size: 12.5px;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ir-toolbar-btn:hover {
    background: #f0f9ff;
    border-color: #38bdf8;
    color: #0284c7;
}

/* ---- 主内容区（三栏） ---- */
.ir-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ---- 左侧历史面板 ---- */
.ir-history-panel {
    width: 185px;
    flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    overflow: hidden;
}

.ir-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ir-history-header h3 {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ir-history-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    background: #3b82f6;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    padding: 0 4px;
    line-height: 16px;
}

.ir-history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 7px;
    border-radius: 3px;
    transition: all 0.15s;
}

.ir-history-clear-btn:hover {
    background: #fde8e8;
}

.ir-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.ir-history-empty {
    text-align: center;
    padding: 28px 14px;
    color: #94a3b8;
}

.ir-history-empty-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.ir-history-empty-text {
    font-size: 12px;
}

.ir-history-item {
    padding: 8px 12px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    position: relative;
}

.ir-history-item:hover {
    background: #eff6ff;
    border-left-color: #93c5fd;
}

.ir-history-item.active {
    background: #eff6ff;
    border-left-color: #3b82f6;
}

.ir-history-item-title {
    font-size: 12px;
    font-weight: 500;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
}

.ir-history-item-meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.ir-history-item-del {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 13px;
    cursor: pointer;
    opacity: 0;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.12s;
    line-height: 1;
}

.ir-history-item:hover .ir-history-item-del {
    opacity: 1;
}

.ir-history-item-del:hover {
    color: #ef4444;
    background: #fde8e8;
}

/* ---- 中间配置面板 ---- */
.ir-config-panel {
    width: 330px;
    flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

.ir-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ir-config-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.ir-panel-tip {
    font-size: 11px;
    color: #94a3b8;
}

.ir-config-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

/* ---- 表单元素 ---- */
.ir-form-group {
    margin-bottom: 16px;
}

.ir-form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.ir-form-label.required::before {
    content: '*';
    color: #ef4444;
    font-size: 13px;
    line-height: 1;
}

.ir-char-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.ir-char-count.char-count-warn {
    color: #f59e0b;
    font-weight: 500;
}

.ir-char-count.char-count-limit {
    color: #ef4444;
    font-weight: 600;
}

.ir-optional-tag {
    font-size: 10px;
    font-weight: 400;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
}

.ir-form-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    resize: vertical;
    transition: border-color 0.15s;
    font-family: inherit;
    line-height: 1.55;
    box-sizing: border-box;
}

.ir-form-textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18);
}

.ir-form-textarea.is-error {
    border-color: #ef4444;
    background: #fff5f5;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.ir-form-textarea-sm {
    font-size: 12.5px;
}

.ir-section-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ---- 按钮选择器 ---- */
.ir-btn-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ir-sel-btn {
    padding: 4px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.ir-sel-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}

.ir-sel-btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: #2563eb;
    color: #fff;
    font-weight: 500;
}

/* ---- 快捷标签 ---- */
.ir-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ir-quick-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 9px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    font-size: 11.5px;
    color: #16a34a;
    cursor: pointer;
    transition: all 0.15s;
}

.ir-quick-tag:hover {
    background: #dcfce7;
    border-color: #86efac;
    transform: translateY(-1px);
}

.ir-quick-tag:focus {
    outline: 2px solid #86efac;
    outline-offset: 1px;
}

/* ---- 操作按钮区 ---- */
.ir-form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.ir-generate-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.ir-generate-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.38);
}

.ir-generate-btn:active {
    transform: translateY(0);
}

.ir-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ir-btn-icon {
    font-size: 15px;
}

.ir-btn-shortcut {
    font-size: 11px;
    opacity: 0.7;
    background: rgba(255,255,255,0.18);
    padding: 1px 5px;
    border-radius: 3px;
}

.ir-cancel-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.ir-cancel-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #ef4444;
}

.ir-draft-hint {
    font-size: 11px;
    color: #22c55e;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.ir-draft-hint.show {
    opacity: 1;
}

/* ---- 输出面板 ---- */
.ir-output-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

.ir-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ir-output-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.ir-output-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ir-scene-badge {
    font-size: 11px;
    font-weight: 500;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 2px 8px;
    border-radius: 10px;
}

.ir-regen-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.ir-regen-btn:hover {
    background: #f0f9ff;
    border-color: #38bdf8;
    color: #0284c7;
}

/* ---- 空状态 ---- */
.ir-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.ir-empty-icon {
    font-size: 52px;
    margin-bottom: 14px;
    animation: ir-float 3s ease-in-out infinite;
}

@keyframes ir-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.ir-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.ir-empty-desc {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.7;
    margin-bottom: 24px;
}

.ir-empty-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-width: 320px;
}

.ir-feature-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 10px;
}

.ir-feature-icon {
    font-size: 14px;
}

/* ---- 加载状态 ---- */
.ir-loading-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.ir-loading-rings {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
}

.ir-loading-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #3b82f6;
    animation: ir-spin 1.2s linear infinite;
}

.ir-loading-ring:nth-child(2) {
    inset: 8px;
    border-top-color: #60a5fa;
    animation-delay: -0.4s;
}

.ir-loading-ring:nth-child(3) {
    inset: 16px;
    border-top-color: #93c5fd;
    animation-delay: -0.8s;
}

@keyframes ir-spin {
    to { transform: rotate(360deg); }
}

.ir-loading-text {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.ir-loading-sub {
    font-size: 12.5px;
    color: #94a3b8;
    margin-bottom: 16px;
}

.ir-loading-dots {
    display: flex;
    gap: 5px;
}

.ir-loading-dots span {
    width: 7px;
    height: 7px;
    background: #93c5fd;
    border-radius: 50%;
    animation: ir-bounce 1.4s ease-in-out infinite;
}

.ir-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.ir-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ir-bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* ---- 回复结果区域 ---- */
.ir-reply-result {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---- 回复卡片 ---- */
.ir-reply-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    animation: ir-card-in 0.35s ease both;
}

.ir-reply-card:nth-child(2) { animation-delay: 0.1s; }
.ir-reply-card:nth-child(3) { animation-delay: 0.2s; }
.ir-reply-card:nth-child(4) { animation-delay: 0.3s; }
.ir-reply-card:nth-child(5) { animation-delay: 0.4s; }

@keyframes ir-card-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.ir-reply-card:hover {
    border-color: #93c5fd;
    border-left-color: #2563eb;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.12);
}

.ir-reply-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: linear-gradient(to right, #eff6ff, #f0f9ff);
    border-bottom: 1px solid #e0e8f8;
}

.ir-reply-card-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: #2563eb;
}

.ir-reply-card-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
}

.ir-reply-card-actions {
    display: flex;
    gap: 5px;
}

.ir-card-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.ir-card-copy-btn:hover {
    background: #f0f9ff;
    border-color: #38bdf8;
    color: #0284c7;
}

/* ---- 字数徽章 ---- */
.ir-word-badge {
    font-size: 11px;
    color: #94a3b8;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 2px 7px;
    border-radius: 8px;
    white-space: nowrap;
    font-weight: 400;
}

.ir-reply-card-body {
    padding: 12px 14px;
    font-size: 13.5px;
    color: #374151;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    transition: background 0.5s ease;
}

.ir-reply-card-body.copied-flash {
    background: #f0fdf4;
    transition: background 0.3s;
}

/* ---- 错误状态 ---- */
.ir-error-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.ir-error-icon {
    font-size: 44px;
    margin-bottom: 12px;
}

.ir-error-text {
    font-size: 14px;
    color: #ef4444;
    margin-bottom: 16px;
}

.ir-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.ir-retry-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}

/* ---- 示例抽屉 ---- */
.ir-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ir-drawer.is-open {
    right: 0;
}

.ir-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    flex-shrink: 0;
}

.ir-drawer-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.ir-drawer-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
    line-height: 1;
}

.ir-drawer-close-btn:hover {
    background: rgba(255,255,255,0.35);
}

.ir-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.ir-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1099;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.ir-drawer-overlay.is-visible {
    opacity: 1;
    pointer-events: all;
}

/* ---- 示例卡片 ---- */
.ir-example-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.ir-example-card:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: translateX(-3px);
}

.ir-example-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ir-example-card-desc {
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ir-example-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.ir-example-tag {
    font-size: 10.5px;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 1px 6px;
    border-radius: 8px;
}

/* ---- 工作日/周末动态背景 ---- */
.ir-container.is-weekday {
    background: linear-gradient(160deg, #ffffff 0%, #f0f9ff 100%);
}

.ir-container.is-weekend {
    background: linear-gradient(160deg, #ffffff 0%, #fdf4ff 100%);
}

/* ---- 滚动条美化 ---- */
.ir-history-list::-webkit-scrollbar,
.ir-config-body::-webkit-scrollbar,
.ir-reply-result::-webkit-scrollbar,
.ir-drawer-body::-webkit-scrollbar {
    width: 4px;
}

.ir-history-list::-webkit-scrollbar-thumb,
.ir-config-body::-webkit-scrollbar-thumb,
.ir-reply-result::-webkit-scrollbar-thumb,
.ir-drawer-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.ir-history-list::-webkit-scrollbar-track,
.ir-config-body::-webkit-scrollbar-track,
.ir-reply-result::-webkit-scrollbar-track,
.ir-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}
