* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    background: #f5f7fa; 
    min-height: 100vh; 
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.container { 
    max-width: 1400px; 
    margin: 0 auto; 
}

/* 卡片样式 */
.layui-card { 
    border-radius: 12px; 
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    background: #fff;
    border: 1px solid #e8e8e8;
    overflow: hidden;
}

/* 头部 */
.layui-card-header { 
    background: #fff;
    color: #333; 
    font-size: 18px; 
    font-weight: 600; 
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.layui-card-header i { 
    color: #1890ff;
    font-size: 20px;
}

.layui-card-body { 
    padding: 24px; 
}

/* 表单区域 */
.form-container { 
    padding: 20px; 
    background: #fafafa; 
    border-radius: 8px; 
    margin-bottom: 24px;
    border: 1px solid #f0f0f0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: #666;
}

.layui-input, .layui-select {
    background: #fff !important;
    border: 1px solid #d9d9d9 !important;
    border-radius: 6px !important;
    color: #333 !important;
    height: 36px;
    transition: all 0.2s;
}

/* 防止 Layui 渲染前的闪烁 */
select[lay-filter] {
    visibility: hidden;
}

.layui-input:hover, .layui-select:hover {
    border-color: #40a9ff !important;
}

.layui-input:focus, .layui-select:focus {
    border-color: #1890ff !important;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 生成按钮 */
.generate-btn {
    background: #1890ff !important;
    border: none !important;
    border-radius: 6px !important;
    height: 36px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.generate-btn:hover {
    background: #40a9ff !important;
}

/* 统计卡片 */
.stats-row { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 16px; 
    margin-bottom: 24px; 
}

.stat-card { 
    padding: 20px 16px; 
    border-radius: 8px; 
    text-align: center;
    background: #fff;
    border: 1px solid #f0f0f0;
}

.stat-card:nth-child(1) { border-top: 3px solid #1890ff; }
.stat-card:nth-child(2) { border-top: 3px solid #722ed1; }
.stat-card:nth-child(3) { border-top: 3px solid #eb2f96; }
.stat-card:nth-child(4) { border-top: 3px solid #52c41a; }

.stat-value { 
    font-size: 28px; 
    font-weight: 600; 
    margin-bottom: 4px;
    color: #333;
}

.stat-label { 
    font-size: 13px; 
    color: #999;
}

/* 预览区域 */
.preview-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    margin-bottom: 20px; 
}

.preview-box { 
    border-radius: 8px; 
    overflow: hidden; 
    background: #fff;
    border: 1px solid #e8e8e8;
}

.preview-box.full { border-top: 2px solid #1890ff; }
.preview-box.simple { border-top: 2px solid #52c41a; }

.preview-header { 
    padding: 12px 16px; 
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.preview-title { 
    font-weight: 500; 
    font-size: 14px; 
    color: #333;
    display: flex; 
    align-items: center; 
    gap: 8px;
}

.preview-title i { font-size: 16px; }
.preview-box.full .preview-title i { color: #1890ff; }
.preview-box.simple .preview-title i { color: #52c41a; }

.preview-count { 
    background: #f0f0f0;
    color: #666;
    padding: 2px 10px; 
    border-radius: 10px; 
    font-size: 12px; 
}

.preview-content { 
    padding: 12px 16px; 
    height: 300px; 
    overflow-y: auto; 
    font-family: 'Consolas', 'Monaco', monospace; 
    font-size: 13px; 
    line-height: 1.8; 
    background: #fff;
    color: #333;
}

.preview-line { 
    padding: 4px 0; 
    border-bottom: 1px solid #f5f5f5;
}

.preview-line:last-child { border-bottom: none; }

.preview-empty {
    color: #999;
    text-align: center;
    padding-top: 100px;
}

.more-hint { 
    color: #999; 
    margin-top: 12px; 
    padding-top: 12px;
    border-top: 1px dashed #e8e8e8;
    font-size: 12px;
    text-align: center;
}

/* 按钮组 */
.download-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 16px; 
}

.download-btn {
    height: 40px;
    line-height: 40px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    transition: all 0.2s;
}

.btn-full {
    background: #1890ff !important;
}
.btn-full:hover { background: #40a9ff !important; }

.btn-simple {
    background: #52c41a !important;
}
.btn-simple:hover { background: #73d13d !important; }

/* 滚动条 */
.preview-content::-webkit-scrollbar {
    width: 6px;
}
.preview-content::-webkit-scrollbar-track {
    background: #f5f5f5;
}
.preview-content::-webkit-scrollbar-thumb {
    background: #d9d9d9;
    border-radius: 3px;
}
.preview-content::-webkit-scrollbar-thumb:hover {
    background: #bfbfbf;
}

/* 广告窗口 */
.ad-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e8e8e8;
    overflow: hidden;
    z-index: 9999;
    transition: all 0.3s ease;
}

.ad-widget:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.ad-header {
    background: linear-gradient(135deg, #1890ff 0%, #722ed1 100%);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ad-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ad-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.ad-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ad-content {
    padding: 16px;
}

.ad-text {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
}

.ad-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: #1890ff;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.ad-btn:hover {
    background: #40a9ff;
}

.ad-widget.minimized {
    width: auto;
    padding: 12px 16px;
}

.ad-widget.minimized .ad-content,
.ad-widget.minimized .ad-close {
    display: none;
}

.ad-widget.minimized .ad-header {
    background: #1890ff;
    border-radius: 8px;
    cursor: pointer;
}

/* 响应式 */
@media (max-width: 1200px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .preview-grid, .download-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .stats-row { grid-template-columns: 1fr; }
    body { padding: 12px; }
    .layui-card-body { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    
    .ad-widget {
        width: calc(100% - 24px);
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
}
