/* ===================================
   Slide Generator - 应用样式
   =================================== */

/* CSS 变量 */
:root {
    /* 主题色 */
    --primary: #1c21f5;
    --primary-light: #4a4fff;
    --primary-dark: #0d10a3;
    --accent: #00f5ff;

    /* 背景色 */
    --bg-deep: #0a0a1f;
    --bg-dark: #12122a;
    --bg-card: rgba(28, 33, 245, 0.08);
    --bg-card-hover: rgba(28, 33, 245, 0.15);

    /* 文字色 */
    --text-white: #ffffff;
    --text-light: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.6);
    --text-dim: rgba(255, 255, 255, 0.4);

    /* 边框 */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(28, 33, 245, 0.5);

    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --glow: 0 0 20px rgba(28, 33, 245, 0.4);

    /* 尺寸 */
    --header-height: 60px;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    /* 动画 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Noto Sans SC', sans-serif;
    background: var(--bg-deep);
    color: var(--text-light);
    min-height: 100vh;
    overflow: hidden;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ===================================
   顶部导航栏
   =================================== */
.header {
    height: var(--header-height);
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.5rem;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.language-select {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.language-select:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-focus);
}

.language-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(28, 33, 245, 0.1);
}

.language-select option {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 8px 12px;
}

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

/* ===================================
   按钮样式
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-white);
    box-shadow: var(--glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(28, 33, 245, 0.6);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-light);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-focus);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-focus);
}

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

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

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-left {
    width: 40%;
    min-width: 400px;
    border-right: 1px solid var(--border-color);
    background: var(--bg-dark);
}

.panel-right {
    flex: 1;
    background: var(--bg-deep);
}

.panel-header {
    height: 50px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
}

/* ===================================
   AI 内容生成区
   =================================== */
.ai-generate-section {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.ai-generate-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-topic-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-deep);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-light);
    font-size: 0.875rem;
    transition: border-color var(--transition-fast);
}

.ai-topic-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(28, 33, 245, 0.1);
}

.ai-topic-input::placeholder {
    color: var(--text-dim);
}

.btn-ai-generate {
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-ai-generate:disabled {
    opacity: 0.6;
}

.btn-ai-generate .btn-loading {
    display: none;
}

.btn-ai-generate.loading .btn-text {
    display: none;
}

.btn-ai-generate.loading .btn-loading {
    display: inline !important;
}

/* ===================================
   编辑器区域
   =================================== */
.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px 20px;
    min-height: 0;
}

.editor-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hint {
    font-weight: 400;
    color: var(--text-dim);
}

.editor {
    flex: 1;
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    color: var(--text-light);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.75;
    resize: none;
    transition: border-color var(--transition-fast);
    letter-spacing: 0.01em;
}

.editor:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(28, 33, 245, 0.1);
}

.editor::placeholder {
    color: var(--text-dim);
}

/* 样式要求区域 */
.style-section {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.style-editor {
    width: 100%;
    height: 120px;
    background: var(--bg-deep);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px;
    color: var(--text-light);
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    line-height: 1.5;
    resize: none;
    transition: border-color var(--transition-fast);
}

.style-editor:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(28, 33, 245, 0.1);
}

.style-editor::placeholder {
    color: var(--text-dim);
}

/* ===================================
   预览区域
   =================================== */
.preview-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-select {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-light);
    font-size: 0.8rem;
    cursor: pointer;
}

.preview-select option {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 8px 12px;
}

.preview-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.preview-container {
    flex: 1;
    position: relative;
    margin: 15px 20px;
    background: #000;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.preview-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

/* ===================================
   进度显示
   =================================== */
.progress-section {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

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

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.progress-count {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width var(--transition-normal);
}

/* ===================================
   文件列表
   =================================== */
.files-section {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    max-height: 200px;
    overflow-y: auto;
    flex-shrink: 0;
}

.files-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 10px;
}

.files-list {
    list-style: none;
}

.files-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 4px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.files-list li:hover {
    background: var(--bg-card-hover);
}

.files-list li.active {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-focus);
}

.files-list li.generating {
    color: var(--accent);
}

.files-list li.generating::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.file-icon {
    opacity: 0.7;
}

.file-name {
    flex: 1;
}

.file-status {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 245, 255, 0.2);
    color: var(--accent);
}

/* 文件操作按钮 */
.file-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-right: 8px;
}

.btn-regenerate {
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0.6;
    transition: all var(--transition-fast);
}

.btn-regenerate:hover {
    opacity: 1;
    background: var(--bg-card-hover);
    border-color: var(--border-focus);
}

.files-list li.generating .btn-regenerate {
    opacity: 0.3;
    pointer-events: none;
}

/* ===================================
   弹窗样式
   =================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 450px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-white);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

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

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-deep);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-light);
    font-size: 0.875rem;
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(28, 33, 245, 0.1);
}

.form-input::placeholder {
    color: var(--text-dim);
}

.form-input[readonly] {
    opacity: 0.7;
    cursor: not-allowed;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 5px;
}

/* 修改需求弹窗特有样式 */
.regenerate-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.regenerate-hint strong {
    color: var(--accent);
}

.regenerate-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

/* ===================================
   Toast 提示
   =================================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-light);
}

.toast.error {
    border-color: #e74c3c;
}

.toast.success {
    border-color: #2ecc71;
}

/* ===================================
   滚动条样式
   =================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(28, 33, 245, 0.3);
}

/* ===================================
   响应式设计
   =================================== */
@media (max-width: 1024px) {
    .panel-left {
        width: 45%;
        min-width: 350px;
    }
}

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

    .panel-left {
        width: 100%;
        min-width: unset;
        height: 50%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .panel-right {
        height: 50%;
    }

    .header {
        padding: 0 15px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}
