/* ========== 探店文案容器 ========== */
.ec-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #fffaf5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.ec-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.ec-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #e55a2b 0%, #b83415 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(184, 52, 21, 0.35);
    flex-shrink: 0;
}

.ec-toolbar .toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 28px;
}

.ec-toolbar .toolbar-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #9b2d10;
    transition: all 0.25s;
    white-space: nowrap;
}

.ec-toolbar .toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.ec-toolbar .toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ec-toolbar .toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ec-toolbar .toolbar-btn-primary {
    background: linear-gradient(135deg, #ffd166 0%, #f4a318 100%);
    color: #6b3300;
    box-shadow: 0 2px 8px rgba(244, 163, 24, 0.35);
}

.ec-toolbar .toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffe080 0%, #ffd166 100%);
    box-shadow: 0 4px 14px rgba(244, 163, 24, 0.5);
}

@keyframes ecToolbarShimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.ec-toolbar .toolbar-btn-primary.loading {
    background: linear-gradient(90deg, #ffd166 25%, #ffe99a 50%, #ffd166 75%);
    background-size: 200% 100%;
    animation: ecToolbarShimmer 1.2s linear infinite;
    opacity: 0.85;
    cursor: not-allowed;
}

/* ========== 主内容三栏 ========== */
.ec-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fffaf5;
}

/* ========== 左侧历史面板 ========== */
.ec-history-panel {
    width: 200px;
    background: white;
    border-right: 1px solid #f0d4be;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.ec-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fafafa 0%, #fff4ec 100%);
    border-bottom: 1px solid #f0d4be;
    flex-shrink: 0;
}

.ec-history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #9b2d10;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ec-history-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e55a2b;
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
}

.ec-history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
}

.ec-history-clear-btn:hover {
    background: #fde8e8;
}

.ec-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.ec-history-item {
    display: flex;
    flex-direction: column;
    padding: 9px 10px;
    margin-bottom: 4px;
    background: #fffaf5;
    border: 1px solid #f0d4be;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.ec-history-item:hover {
    background: #ffeedd;
    border-color: #e55a2b;
    transform: translateX(2px);
}

.ec-history-item:focus-visible {
    outline: 2px solid #e55a2b;
    outline-offset: 1px;
}

.ec-history-item.active {
    background: #fde8d8;
    border-color: #e55a2b;
    border-left: 3px solid #b83415;
    box-shadow: 0 1px 3px rgba(229, 90, 43, 0.18);
}

.ec-history-item-shop {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
    padding-right: 22px;
}

.ec-history-item-meta {
    font-size: 11px;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ec-history-item-time {
    font-size: 11px;
    color: #b0bec5;
}

.ec-history-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: #fde8e8;
    color: #ef4444;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    line-height: 1;
}

.ec-history-item:hover .ec-history-del {
    opacity: 1;
}

.ec-history-del:hover {
    background: #ef4444;
    color: white;
}

.ec-history-empty {
    text-align: center;
    padding: 24px 12px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.8;
}

/* ========== 中间输入面板 ========== */
.ec-input-panel {
    width: 320px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid #f0d4be;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ec-input-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa 0%, #fff4ec 100%);
    border-bottom: 1px solid #f0d4be;
    font-size: 13px;
    font-weight: 600;
    color: #9b2d10;
    flex-shrink: 0;
}

.ec-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 20px;
}

/* 表单组 */
.ec-form-group {
    margin-bottom: 13px;
}

.ec-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #9b2d10;
    margin-bottom: 5px;
}

.ec-required {
    color: #ef4444;
    margin-left: 2px;
}

.ec-label-hint {
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
}

.ec-form-input,
.ec-form-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #f0d4be;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fffbf7;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.ec-form-input:focus,
.ec-form-textarea:focus {
    border-color: #e55a2b;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(229, 90, 43, 0.1);
}

.ec-form-textarea {
    resize: vertical;
    min-height: 66px;
}

.ec-form-input.is-error,
.ec-form-textarea.is-error {
    border-color: #ef4444 !important;
    background: #fff5f5 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* 选项按钮组 */
.ec-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ec-btn-option {
    padding: 4px 9px;
    border: 1px solid #f0d4be;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    background: #fffbf7;
    color: #9b2d10;
    transition: all 0.2s;
    user-select: none;
}

.ec-btn-option:hover {
    border-color: #e55a2b;
    background: #ffeedd;
}

.ec-btn-option:focus-visible {
    outline: 2px solid #e55a2b;
    outline-offset: 2px;
}

.ec-btn-option.active {
    border-color: #cc4a1f;
    background: linear-gradient(135deg, #f4815a 0%, #cc4a1f 100%);
    color: white;
    font-weight: 500;
}

/* 字符计数 */
.ec-char-counter {
    text-align: right;
    font-size: 11px;
    color: #b0bec5;
    margin-top: 3px;
    user-select: none;
}

.ec-shortcut-hint {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
}

/* 生成按钮 */
@keyframes ecBtnGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(204, 74, 31, 0.25); }
    50%       { box-shadow: 0 4px 22px rgba(204, 74, 31, 0.55); }
}

.ec-generate-btn {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #e55a2b 0%, #b83415 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.5px;
    animation: ecBtnGlow 2.4s ease-in-out infinite;
}

.ec-generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(184, 52, 21, 0.45);
    animation: none;
}

.ec-generate-btn:active:not(:disabled) { transform: translateY(0); }

.ec-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    animation: none;
}

.ec-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: ecSpin 0.8s linear infinite;
    display: none;
}

.ec-generate-btn.loading .ec-spinner { display: block; }
.ec-generate-btn.loading .ec-btn-text { display: none; }

.ec-btn-loading-text { display: none; font-size: 13px; }
.ec-generate-btn.loading .ec-btn-loading-text { display: inline; }

@keyframes ecSpin { to { transform: rotate(360deg); } }

/* ========== 右侧结果面板 ========== */
.ec-result-panel {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 320px;
}

.ec-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa 0%, #fff4ec 100%);
    border-bottom: 1px solid #f0d4be;
    flex-shrink: 0;
}

.ec-result-title {
    font-size: 13px;
    font-weight: 600;
    color: #9b2d10;
}

.ec-result-actions { display: flex; gap: 6px; }

.ec-result-action-btn {
    padding: 4px 10px;
    border: 1px solid #f0d4be;
    border-radius: 4px;
    background: white;
    font-size: 11px;
    cursor: pointer;
    color: #9b2d10;
    transition: all 0.2s;
}

.ec-result-action-btn:hover {
    border-color: #e55a2b;
    background: #ffeedd;
}

.ec-result-action-btn.ec-btn-short {
    border-color: #f4a318;
    color: #7a4a00;
    background: #fffbf0;
}

.ec-result-action-btn.ec-btn-short:hover {
    background: #fff8e1;
    border-color: #f4a318;
    box-shadow: 0 2px 6px rgba(244, 163, 24, 0.2);
}

.ec-result-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 18px 28px;
}

/* ===== 空状态 ===== */
.ec-result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    gap: 12px;
    color: #94a3b8;
}

.ec-empty-icon { font-size: 54px; opacity: 0.6; }

.ec-empty-title {
    font-size: 15px;
    font-weight: 500;
    color: #cc4a1f;
}

.ec-empty-desc {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.7;
    max-width: 260px;
}

/* ===== 骨架屏 ===== */
.ec-skeleton { display: none; flex: 1; min-height: 0; }
.ec-skeleton.show { display: block; }

.ec-skel-header-block {
    background: linear-gradient(135deg, #fff0e5 0%, #fde0ca 100%);
    border: 1px solid #f9cbb0;
    border-left: 4px solid #f4815a;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.ec-skel-item {
    background: linear-gradient(90deg, #fde8d8 25%, #f9d0b8 50%, #fde8d8 75%);
    background-size: 200% 100%;
    animation: ecShimmer 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 10px;
}

@keyframes ecShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ec-skel-title-bar    { height: 28px; width: 75%; }
.ec-skel-subtitle-bar { height: 18px; width: 55%; }
.ec-skel-rating-bar   { height: 16px; width: 40%; }
.ec-skel-bar          { height: 16px; }
.ec-skel-short        { width: 72%; }
.ec-skel-tags-bar     { height: 32px; border-radius: 16px; }

/* ===== 结果展示 ===== */
.ec-result-wrap { display: none; }
.ec-result-wrap.show {
    display: block;
    animation: ecFadeIn 0.28s ease;
}

@keyframes ecFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 文案头部标题区 */
.ec-copy-header {
    background: linear-gradient(135deg, #fff0e5 0%, #fde0ca 100%);
    border: 1px solid #f9cbb0;
    border-left: 4px solid #e55a2b;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 14px;
}

.ec-copy-title {
    font-size: 20px;
    font-weight: 700;
    color: #7a1f06;
    margin: 0 0 6px;
    line-height: 1.35;
}

.ec-copy-subtitle {
    font-size: 13px;
    color: #9b4620;
    font-style: italic;
    margin: 0 0 10px;
    line-height: 1.6;
}

.ec-copy-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ec-rating-stars {
    font-size: 15px;
    letter-spacing: 2px;
}

.ec-rating-note {
    font-size: 12px;
    color: #8a4020;
    font-weight: 500;
}

/* 段落区块通用 */
.ec-copy-section {
    margin-bottom: 14px;
}

.ec-copy-section:last-child {
    margin-bottom: 0;
}

.ec-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #9b2d10;
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-left: 3px solid #e55a2b;
    padding-left: 8px;
}

/* 区块标题行：左対齐标题，右对齐字数徽章 */
.ec-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}

.ec-section-header .ec-section-label {
    margin-bottom: 0;
}

/* 字数徽章 */
.ec-word-count {
    font-size: 11px;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}

.ec-section-hint {
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
}

/* 正文区块 */
.ec-copy-content {
    font-size: 14px;
    color: #374151;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 14px 18px;
    background: #fffaf7;
    border: 1px solid #f0dcd0;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* 短版文案 */
.ec-copy-short {
    font-size: 13px;
    color: #374151;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 12px 16px;
    background: #fff8f4;
    border: 1px solid #fad5b8;
    border-radius: 8px;
    border-left: 4px solid #f4a318;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* 行动号召 */
.ec-copy-cta {
    font-size: 13px;
    color: #e55a2b;
    font-weight: 500;
    line-height: 1.65;
    padding: 10px 14px;
    background: #fff3ee;
    border: 1px solid #fac4aa;
    border-radius: 8px;
}

/* 话题标签 */
.ec-copy-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.ec-tag-item {
    padding: 4px 12px;
    background: #fff0e5;
    border: 1px solid #f9cbb0;
    border-radius: 14px;
    font-size: 12px;
    color: #9b2d10;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    user-select: none;
}

.ec-tag-item:hover {
    background: #fde8d8;
    border-color: #e55a2b;
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(229, 90, 43, 0.18);
}

/* 探店贴士 */
.ec-copy-tips {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ec-tip-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 13px;
    color: #166534;
    line-height: 1.6;
}

.ec-tip-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ===== 错误状态 ===== */
.ec-result-error {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    padding: 32px;
}

.ec-error-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.85; }

.ec-error-msg {
    font-size: 14px;
    line-height: 1.6;
    color: #ef4444;
    max-width: 260px;
}

.ec-retry-btn {
    margin-top: 14px;
    padding: 8px 22px;
    border: 1px solid #ef4444;
    color: #ef4444;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.ec-retry-btn:hover { background: #fef2f2; }

/* ========== 示例抽屉 ========== */
.ec-drawer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(2px);
}

.ec-drawer-overlay.show {
    opacity: 1;
    visibility: visible;
}

.ec-example-drawer {
    position: fixed;
    top: 0;
    right: -500px;
    width: 480px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 10002;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.ec-example-drawer.show { right: 0; }

.ec-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #f0d4be;
    flex-shrink: 0;
    background: linear-gradient(135deg, #e55a2b 0%, #b83415 100%);
    color: white;
}

.ec-drawer-title { font-size: 15px; font-weight: 600; }

.ec-drawer-close {
    width: 30px; height: 30px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ec-drawer-close:hover { background: rgba(255,255,255,0.35); }

.ec-drawer-body { flex: 1; overflow-y: auto; padding: 16px; }

.ec-example-card {
    border: 1px solid #f0d4be;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fffaf7;
}

.ec-example-card:hover {
    border-color: #e55a2b;
    background: #ffeedd;
    transform: translateX(-3px);
    box-shadow: 2px 0 8px rgba(229, 90, 43, 0.1);
}

.ec-example-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #7a1f06;
    margin-bottom: 5px;
}

.ec-example-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.ec-example-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: #fff0e5;
    color: #9b2d10;
}

.ec-example-card-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

/* ========== Toast ========== */
.ec-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ec-toast {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: ecToastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
}

.ec-toast.success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.ec-toast.error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.ec-toast.info    { background: #fff3e0; color: #7a3800; border-left: 4px solid #f59e0b; }

@keyframes ecToastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ========== 自定义滚动条 ========== */
.ec-history-list::-webkit-scrollbar,
.ec-input-body::-webkit-scrollbar,
.ec-result-body::-webkit-scrollbar,
.ec-drawer-body::-webkit-scrollbar {
    width: 5px;
}

.ec-history-list::-webkit-scrollbar-track,
.ec-input-body::-webkit-scrollbar-track,
.ec-result-body::-webkit-scrollbar-track,
.ec-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

.ec-history-list::-webkit-scrollbar-thumb,
.ec-input-body::-webkit-scrollbar-thumb,
.ec-result-body::-webkit-scrollbar-thumb,
.ec-drawer-body::-webkit-scrollbar-thumb {
    background: rgba(229, 90, 43, 0.35);
    border-radius: 2px;
}

.ec-history-list::-webkit-scrollbar-thumb:hover,
.ec-input-body::-webkit-scrollbar-thumb:hover,
.ec-result-body::-webkit-scrollbar-thumb:hover,
.ec-drawer-body::-webkit-scrollbar-thumb:hover {
    background: rgba(229, 90, 43, 0.65);
}
