/* ========== 口播稿生成容器 ========== */
.lbs-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: linear-gradient(135deg, #fff5f5 0%, #fff8f0 50%, #fffaf0 100%);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.lbs-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.lbs-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #e53e3e 0%, #dd6b20 60%, #ed8936 100%);
    border-bottom: none;
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.35);
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 28px;
}

.toolbar-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #c53030;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.toolbar-btn:active {
    transform: translateY(0);
}

/* ========== 主内容区 ========== */
.lbs-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========== 左侧历史面板 ========== */
.lbs-history-panel {
    width: 220px;
    min-width: 180px;
    max-width: 260px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #fed7aa;
    flex-shrink: 0;
    overflow: hidden;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fef9f0 0%, #fef3e2 100%);
    border-bottom: 1px solid #fed7aa;
}

.history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #c05621;
    background: none;
    border: none;
    padding: 0;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #e53e3e;
    font-size: 11px;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 4px;
    transition: all 0.2s;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

.history-search {
    padding: 8px 10px;
    border-bottom: 1px solid #fde8c8;
    background: #fffaf5;
}

.history-search input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #fbd38d;
    border-radius: 4px;
    font-size: 12px;
    color: #4a5568;
    background: #fff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.history-search input:focus {
    border-color: #ed8936;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.history-empty {
    text-align: center;
    color: #a0aec0;
    font-size: 12px;
    padding: 20px 10px;
}

.history-item {
    padding: 9px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    margin-bottom: 4px;
    background: #fff;
    position: relative;
}

.history-item:hover {
    background: #fff8f0;
    border-color: #fbd38d;
}

.history-item.active {
    background: #feebcb;
    border-color: #ed8936;
}

/* 历史记录单条删除按钮 */
.history-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: #fde8e8;
    border: none;
    border-radius: 50%;
    color: #e53e3e;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: all 0.2s;
    flex-shrink: 0;
}

.history-item:hover .history-delete-btn {
    display: flex;
}

.history-delete-btn:hover {
    background: #e53e3e;
    color: #fff;
    transform: scale(1.1);
}

body.dark .history-delete-btn {
    background: #3d1e1e;
    color: #fc8181;
}

body.dark .history-delete-btn:hover {
    background: #e53e3e;
    color: #fff;
}

.history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.history-item-meta {
    font-size: 11px;
    color: #a0aec0;
    display: flex;
    gap: 5px;
    align-items: center;
}

.history-item-badge {
    background: #fef3c7;
    color: #c05621;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
}

/* ========== 中间输入面板 ========== */
.input-panel {
    flex: 0 0 400px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #fed7aa;
    background: #fff;
    overflow: hidden;
}

.input-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fffaf0 0%, #fef9f0 100%);
    border-bottom: 1px solid #fde8c8;
    flex-shrink: 0;
}

.input-header h3 {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    color: #c05621;
    background: none;
    border: none;
    padding: 0;
}

.input-tip {
    font-size: 11px;
    color: #a0aec0;
}

.input-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

/* 快捷标签 */
.quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
    align-items: center;
}

.tag-label {
    font-size: 11px;
    color: #718096;
    white-space: nowrap;
}

.quick-tag {
    padding: 3px 9px;
    background: #fff8f0;
    border: 1px solid #fbd38d;
    border-radius: 12px;
    font-size: 11px;
    color: #c05621;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-tag:hover {
    background: #feebcb;
    border-color: #ed8936;
}

/* 输入组 */
.input-group {
    margin-bottom: 12px;
    position: relative;
}

.input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

.input-group.half {
    flex: 1;
    margin-bottom: 12px;
    min-width: 0;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
}

.required {
    color: #e53e3e;
}

.input-group input[type="text"],
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #2d3748;
    background: #fafafa;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.input-group input[type="text"]:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: #ed8936;
    box-shadow: 0 0 0 3px rgba(237, 137, 54, 0.1);
    background: #fff;
}

.input-group textarea {
    resize: vertical;
    min-height: 70px;
}

.char-counter {
    text-align: right;
    font-size: 11px;
    color: #a0aec0;
    margin-top: 3px;
}

/* 提交按钮区域 */
.submit-area {
    margin-top: 16px;
    text-align: center;
}

.submit-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #e53e3e 0%, #dd6b20 60%, #ed8936 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
    position: relative;
    overflow: hidden;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(229, 62, 62, 0.4);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.submit-btn .btn-icon {
    font-size: 18px;
}

/* 按鈕扫光动画 */
.submit-btn:not(:disabled)::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    animation: shimmerBtn 3s ease-in-out infinite;
}

@keyframes shimmerBtn {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* 取消生成按钮 */
.cancel-btn {
    width: 100%;
    margin-top: 8px;
    padding: 9px 20px;
    background: #fff;
    color: #718096;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cancel-btn:hover {
    background: #fff5f5;
    border-color: #fc8181;
    color: #e53e3e;
}

body.dark .cancel-btn {
    background: #2d2d2d;
    color: #718096;
    border-color: #4a4a4a;
}

body.dark .cancel-btn:hover {
    background: #3d1515;
    border-color: #fc8181;
    color: #fc8181;
}

.shortcut-hint {
    margin-top: 6px;
    font-size: 11px;
    color: #a0aec0;
}

/* ========== 右侧结果面板 ========== */
.result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-width: 0;
    overflow: hidden;
}

.result-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fffaf0 0%, #fef9f0 100%);
    border-bottom: 1px solid #fde8c8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.result-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #c05621;
    background: none;
    border: none;
    padding: 0;
}

.result-actions {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 5px 10px;
    background: #fff8f0;
    border: 1px solid #fbd38d;
    border-radius: 5px;
    font-size: 12px;
    color: #c05621;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #feebcb;
    border-color: #ed8936;
}

.result-meta {
    padding: 8px 16px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-bottom: 1px solid #fde8c8;
    background: #fffcf8;
    flex-shrink: 0;
}

.meta-tag {
    background: #feebcb;
    color: #c05621;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.meta-tag.word-count {
    background: #e2e8f0;
    color: #4a5568;
    margin-left: auto;
}

.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    position: relative;
}

/* 占位符 */
.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #a0aec0;
    text-align: center;
    padding: 40px 20px;
}

.placeholder-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder-text {
    font-size: 15px;
    font-weight: 500;
    color: #718096;
    margin-bottom: 16px;
}

.placeholder-tips {
    text-align: left;
    background: #fafafa;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: #718096;
    border: 1px solid #e2e8f0;
    max-width: 320px;
}

.placeholder-tips p {
    margin: 0 0 8px;
    font-weight: 600;
}

.placeholder-tips ul {
    margin: 0;
    padding-left: 16px;
}

.placeholder-tips li {
    margin-bottom: 4px;
    line-height: 1.6;
}

/* 生成结果 */
.script-output {
    font-size: 14px;
    line-height: 1.9;
    color: #2d3748;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fffcf8;
    border: 1px solid #fde8c8;
    border-left: 4px solid #e53e3e;
    border-radius: 8px;
    padding: 16px 20px;
    min-height: 200px;
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* 加载状态 */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #fde8c8;
    border-top-color: #e53e3e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    color: #718096;
    font-size: 14px;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%   { content: ''; }
    33%  { content: '.'; }
    66%  { content: '..'; }
    100% { content: '...'; }
}

/* 历史记录数量徽标 */
.history-count {
    display: inline-block;
    background: #fbd38d;
    color: #c05621;
    border-radius: 10px;
    font-size: 10px;
    padding: 1px 6px;
    margin-left: 4px;
    font-weight: 600;
    vertical-align: middle;
}

/* 新增历史记录闪光动画 */
@keyframes flashNew {
    0%, 100% { background-color: #fff8f0; border-color: #fbd38d; }
    50% { background-color: #feebcb; border-color: #ed8936; }
}

.history-item.flash-new {
    animation: flashNew 0.5s ease 3;
}

/* ========== 弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    background: none;
    border: none;
    padding: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #718096;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f7fafc;
    color: #2d3748;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
}

/* 示例网格 */
.example-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.example-item {
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.example-item:hover {
    border-color: #ed8936;
    background: #fff8f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.15);
}

.example-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.example-item-desc {
    font-size: 12px;
    color: #718096;
    line-height: 1.5;
}

.example-item-tags {
    margin-top: 8px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.example-item-tag {
    background: #feebcb;
    color: #c05621;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 10px;
}

/* ========== 暗黑模式 ========== */
body.dark .lbs-container {
    background: linear-gradient(135deg, #1a1a1a 0%, #1e1a0e 50%, #1a1800 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.dark .lbs-history-panel {
    background: #1e1e1e;
    border-right-color: #3d2f1a;
}

body.dark .history-header {
    background: linear-gradient(to bottom, #2a2016 0%, #1e1a0e 100%);
    border-bottom-color: #3d2f1a;
}

body.dark .history-header h3 {
    color: #fbd38d;
}

body.dark .history-clear-btn {
    background: #2d1515;
    color: #fc8181;
}

body.dark .history-clear-btn:hover {
    background: #3d1e1e;
}

body.dark .history-search {
    background: #1a1a1a;
    border-bottom-color: #3d2f1a;
}

body.dark .history-search input {
    background: #2d2d2d;
    border-color: #4a3520;
    color: #e2e8f0;
}

body.dark .history-search input:focus {
    border-color: #ed8936;
}

body.dark .history-item {
    background: #242424;
    color: #e2e8f0;
}

body.dark .history-item:hover {
    background: #2a2016;
    border-color: #4a3520;
}

body.dark .history-item.active {
    background: #3d2f1a;
    border-color: #ed8936;
}

body.dark .history-item-title {
    color: #e2e8f0;
}

body.dark .history-item-meta {
    color: #718096;
}

body.dark .history-item-badge {
    background: #3d2f1a;
    color: #fbd38d;
}

body.dark .history-empty {
    color: #4a5568;
}

body.dark .history-count {
    background: #3d2f1a;
    color: #fbd38d;
}

@keyframes flashNewDark {
    0%, 100% { background-color: #2a2016; border-color: #4a3520; }
    50% { background-color: #3d2f1a; border-color: #ed8936; }
}

body.dark .history-item.flash-new {
    animation: flashNewDark 0.5s ease 3;
}

body.dark .input-panel {
    background: #1e1e1e;
    border-right-color: #3d2f1a;
}

body.dark .input-header {
    background: linear-gradient(to bottom, #2a2016 0%, #1e1a0e 100%);
    border-bottom-color: #3d2f1a;
}

body.dark .input-header h3 {
    color: #fbd38d;
}

body.dark .input-tip {
    color: #4a5568;
}

body.dark .input-content {
    background: #1e1e1e;
}

body.dark .tag-label {
    color: #718096;
}

body.dark .quick-tag {
    background: #2a2016;
    border-color: #4a3520;
    color: #fbd38d;
}

body.dark .quick-tag:hover {
    background: #3d2f1a;
    border-color: #ed8936;
}

body.dark .input-group label {
    color: #cbd5e0;
}

body.dark .input-group input[type="text"],
body.dark .input-group select,
body.dark .input-group textarea {
    background: #2d2d2d;
    border-color: #4a4a4a;
    color: #e2e8f0;
}

body.dark .input-group input[type="text"]:focus,
body.dark .input-group select:focus,
body.dark .input-group textarea:focus {
    border-color: #ed8936;
    background: #333;
    box-shadow: 0 0 0 3px rgba(237, 137, 54, 0.15);
}

body.dark .char-counter {
    color: #4a5568;
}

body.dark .shortcut-hint {
    color: #4a5568;
}

body.dark .result-panel {
    background: #1e1e1e;
}

body.dark .result-header {
    background: linear-gradient(to bottom, #2a2016 0%, #1e1a0e 100%);
    border-bottom-color: #3d2f1a;
}

body.dark .result-header h3 {
    color: #fbd38d;
}

body.dark .action-btn {
    background: #2a2016;
    border-color: #4a3520;
    color: #fbd38d;
}

body.dark .action-btn:hover {
    background: #3d2f1a;
    border-color: #ed8936;
}

body.dark .result-meta {
    background: #1e1a0e;
    border-bottom-color: #3d2f1a;
}

body.dark .meta-tag {
    background: #3d2f1a;
    color: #fbd38d;
}

body.dark .meta-tag.word-count {
    background: #2d3748;
    color: #a0aec0;
}

body.dark .result-content {
    background: #1e1e1e;
}

body.dark .placeholder-text {
    color: #4a5568;
}

body.dark .placeholder-tips {
    background: #242424;
    border-color: #3d3d3d;
    color: #718096;
}

body.dark .script-output {
    background: #242424;
    border-color: #3d2f1a;
    border-left-color: #e53e3e;
    color: #e2e8f0;
}

body.dark .loading-spinner {
    border-color: #3d2f1a;
    border-top-color: #e53e3e;
}

body.dark .loading-text {
    color: #718096;
}

body.dark .modal-content {
    background: #1e1e1e;
}

body.dark .modal-header {
    border-bottom-color: #3d3d3d;
}

body.dark .modal-header h3 {
    color: #e2e8f0;
}

body.dark .modal-close {
    color: #718096;
}

body.dark .modal-close:hover {
    background: #2d2d2d;
    color: #e2e8f0;
}

body.dark .example-item {
    background: #242424;
    border-color: #3d3d3d;
}

body.dark .example-item:hover {
    border-color: #ed8936;
    background: #2a2016;
}

body.dark .example-item-title {
    color: #e2e8f0;
}

body.dark .example-item-desc {
    color: #718096;
}

body.dark .example-item-tag {
    background: #3d2f1a;
    color: #fbd38d;
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .input-panel {
        flex: 0 0 320px;
        min-width: 280px;
    }

    .lbs-history-panel {
        width: 180px;
    }
}

@media (max-width: 700px) {
    .lbs-main-content {
        flex-direction: column;
    }

    .lbs-history-panel {
        width: 100%;
        max-width: none;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid #fed7aa;
        height: 120px;
    }

    .input-panel {
        flex: 0 0 auto;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid #fed7aa;
        max-height: 45vh;
    }

    .result-panel {
        flex: 1;
        min-height: 200px;
    }

    .input-row {
        flex-direction: column;
        gap: 0;
    }

    .input-group.half {
        flex: none;
    }

    .example-grid {
        grid-template-columns: 1fr;
    }
}
