/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
    line-height: 1.5;
    overflow: hidden;
}

/* 主布局 - 经典编辑器三栏布局 */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ========== 左侧导航栏 ========== */
.sidebar-left {
    width: 60px;
    background: #2c3e50;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    z-index: 100;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 4px;
    color: #95a5a6;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    gap: 4px;
}

.sidebar-item:hover {
    color: #ecf0f1;
    background: rgba(255,255,255,0.05);
}

.sidebar-item.active {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border-left: 3px solid #e74c3c;
}

.sidebar-icon {
    font-size: 20px;
}

/* ========== 左侧面板区域 ========== */
.panel-left {
    width: 280px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
}

.panel-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.panel-tab {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}

.panel-tab:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.panel-tab.active {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* 模板卡片 */
.template-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 8px;
}

/* 滚动条样式 */
.template-grid::-webkit-scrollbar {
    width: 6px;
}

.template-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.template-grid::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 3px;
}

.template-grid::-webkit-scrollbar-thumb:hover {
    background: #d0d0d0;
}

.template-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.template-card:hover {
    border-color: #e74c3c;
    box-shadow: 0 2px 12px rgba(231, 76, 60, 0.15);
    transform: translateY(-2px);
}

.template-card.active {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.template-thumb {
    padding-top: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7f1 100%);
    position: relative;
    overflow: hidden;
}

.template-thumb > div {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-vip {
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.template-info {
    padding: 8px;
}

.template-name {
    font-size: 12px;
    color: #333;
    font-weight: 500;
}

.template-price {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}

/* 分页控件 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.pagination-btn {
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    color: #666;
    min-width: 36px;
    text-align: center;
}

.pagination-btn:hover:not(.disabled) {
    border-color: #e74c3c;
    color: #e74c3c;
}

.pagination-btn.active {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border-color: #e74c3c;
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.disabled:hover {
    border-color: #e0e0e0;
    color: #666;
}

.template-name {
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-price {
    font-size: 11px;
    color: #e74c3c;
    font-weight: 600;
}

/* ========== 中间编辑区 ========== */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f0f0;
    min-width: 0;
}

/* 顶部工具栏 */
.editor-toolbar {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 16px;
    border-right: 1px solid #e0e0e0;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-btn {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.toolbar-btn.primary {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.toolbar-btn.primary:hover {
    background: #c0392b;
}

.toolbar-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    color: #555;
    cursor: pointer;
}

/* 编辑主体 */
.editor-body {
    flex: 1;
    display: flex;
    padding: 20px;
    gap: 20px;
    overflow: hidden;
}

/* 输入区域 */
.input-panel {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-toolbar {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.panel-toolbar-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.panel-toolbar-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.btn-small:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.btn-small.danger {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.btn-small.danger:hover {
    background: #c0392b;
}

.input-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.textarea-editor {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    outline: none;
    font-family: inherit;
}

.textarea-editor::placeholder {
    color: #999;
}

/* 预览区域 */
.preview-panel {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #fafafa;
}

.preview-placeholder {
    color: #999;
    text-align: center;
    padding: 60px 20px;
    font-size: 14px;
}

/* ========== 右侧功能面板 ========== */
.sidebar-right {
    width: 280px;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right-panel-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.right-panel-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.right-panel-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.right-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* AI助手卡片 */
.ai-card {
    background: linear-gradient(135deg, #fff9f0 0%, #fff5e6 100%);
    border: 1px solid #ffd8b8;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.ai-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #e67e22;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-step-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-step-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

.ai-step-num {
    width: 20px;
    height: 20px;
    background: #e67e22;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

.ai-prompt-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    font-size: 11px;
    color: #666;
    line-height: 1.6;
    max-height: 100px;
    overflow-y: auto;
    margin: 10px 0;
}

.btn-copy-ai {
    width: 100%;
    padding: 8px;
    background: #e67e22;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy-ai:hover {
    background: #d35400;
}

/* 操作按钮组 */
.action-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.btn-action {
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-action-primary {
    background: #e74c3c;
    color: white;
    border: none;
}

.btn-action-primary:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-action-secondary {
    background: #fff;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.btn-action-secondary:hover {
    background: #fdf2f2;
}

/* 推广卡片 */
.promo-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.promo-title {
    font-size: 16px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.promo-title::before {
    content: '🎁';
    font-size: 18px;
}

.promo-title::after {
    content: '⭐';
    font-size: 16px;
}

.promo-text {
    font-size: 13px;
    color: #a16207;
    line-height: 1.4;
}

/* 分类列表 - 右侧大分类 */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-item:hover {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.category-item.active {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border-color: #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.25);
}

.category-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.category-arrow {
    font-size: 11px;
    margin-left: auto;
    transition: transform 0.2s;
    opacity: 0.5;
}

.category-item:hover .category-arrow {
    opacity: 1;
}

.category-item.active .category-arrow {
    opacity: 1;
}

/* 分类列表 - 左侧小分类 */
.category-list-small {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 12px;
    padding: 8px 0;
    border-top: 1px solid #f0f0f0;
    max-height: 132px; /* 3行 * 44px */
    overflow: hidden;
}

/* 分类分页 */
.category-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 0;
    border-top: 1px solid #f0f0f0;
}

.category-pagination-btn {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.category-pagination-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.category-pagination-btn:active {
    background: #e74c3c;
    color: white;
}

.category-pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-pagination-btn.disabled:hover {
    border-color: #e0e0e0;
    color: #333;
    background: white;
}

.category-item-small {
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 36px;
    box-sizing: border-box;
    overflow: hidden;
}

.category-item-small span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.category-item-small:hover {
    border-color: #e74c3c;
    background: #fdf2f2;
    color: #e74c3c;
}

.category-item-small.active {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border-color: #e74c3c;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.2);
}

.category-item-small .category-icon {
    font-size: 12px;
    width: 16px;
}

.category-item-small .category-arrow {
    font-size: 9px;
    opacity: 0.7;
}

.template-subitem {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.template-subitem:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.template-subitem.active {
    background: #fdf2f2;
    border-color: #e74c3c;
    color: #e74c3c;
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 12px;
    padding: 24px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.toast-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.toast-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.toast-message {
    font-size: 14px;
    color: #666;
}

.toast-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.toast-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式 */
@media (max-width: 1400px) {
    .panel-left {
        width: 240px;
    }
    .sidebar-right {
        width: 240px;
    }
}

@media (max-width: 1200px) {
    .panel-left {
        display: none;
    }
}

@media (max-width: 900px) {
    .sidebar-right {
        display: none;
    }
    .editor-body {
        flex-direction: column;
    }
}

/* ========== 激活弹窗样式 ========== */
#wetypo-activation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
}

.activation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.activation-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.activation-header {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    padding: 24px;
    text-align: center;
    color: white;
}

.activation-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.activation-header h3 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

.activation-body {
    padding: 24px;
}

.activation-tip {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

#activation-code-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 18px;
    letter-spacing: 2px;
    text-align: center;
    transition: all 0.2s;
    box-sizing: border-box;
}

#activation-code-input:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.activation-error {
    color: #e74c3c;
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    min-height: 18px;
}

.activation-footer {
    padding: 0 24px 24px;
}

.activation-btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.activation-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.activation-btn-primary:active {
    transform: translateY(0);
}

.activation-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
