/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.header {
    text-align: center;
    padding: 40px 20px;
    color: white;
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 48px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.logo h1 {
    font-size: 42px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 18px;
    opacity: 0.95;
    margin-top: 10px;
    font-weight: 300;
}

/* 主要内容 */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* 输入区域 */
.input-section {
    background: white;
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 10px;
    font-size: 16px;
}

.input-group label i {
    color: var(--primary-color);
}

textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: white;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* 选项网格 */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.option-group label {
    font-size: 14px;
    margin-bottom: 8px;
}

/* 生成按钮 */
.generate-btn {
    width: 100%;
    padding: 16px 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

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

/* 输出区域 */
.output-section {
    background: white;
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-100);
}

.output-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    color: var(--gray-800);
}

.output-header h2 i {
    color: var(--primary-color);
}

.output-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px 12px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--gray-200);
    color: var(--primary-color);
}

/* 输出内容 */
.output-content {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
}

.output-content:empty {
    display: none;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--gray-400);
}

.placeholder i {
    font-size: 48px;
    margin-bottom: 15px;
}

.placeholder p {
    font-size: 16px;
    text-align: center;
}

/* 生成的文案样式 */
.generated-copy {
    white-space: pre-wrap;
    line-height: 1.8;
    color: var(--gray-700);
    font-size: 15px;
}

.copy-meta {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--gray-500);
}

.copy-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 加载动画 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

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

.loading p {
    color: var(--gray-600);
    font-size: 16px;
}

/* 历史记录侧边栏 */
.history-sidebar {
    position: fixed;
    right: -350px;
    top: 0;
    width: 350px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.history-sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    color: var(--gray-800);
}

.toggle-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-600);
    padding: 5px;
}

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

.history-item {
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.history-item:hover {
    background: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.history-item-prompt {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
    flex: 1;
    margin-right: 10px;
}

.history-item-delete {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 2px 5px;
    font-size: 12px;
}

.history-item-delete:hover {
    color: var(--danger-color);
}

.history-item-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--gray-500);
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 14px;
    opacity: 0.9;
}

/* 动画 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast 通知 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast i {
    font-size: 20px;
}

.toast.success i {
    color: var(--success-color);
}

.toast.error i {
    color: var(--danger-color);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .logo h1 {
        font-size: 32px;
    }

    .logo i {
        font-size: 36px;
    }

    .subtitle {
        font-size: 16px;
    }

    .input-section,
    .output-section {
        padding: 20px;
    }

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

    .history-sidebar {
        width: 100%;
        right: -100%;
    }
}

/* 滚动条样式 */
.output-content::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
    width: 8px;
}

.output-content::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 10px;
}

.output-content::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 10px;
}

.output-content::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}
