/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: 14px; color: #333; background: #f5f6fa; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; outline: none; border: 1px solid #dcdfe6; border-radius: 4px; padding: 8px 12px; transition: border-color .2s; }
input:focus, select:focus, textarea:focus { border-color: #409eff; }

/* ===== Layout ===== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1d2129; color: #c9cdd4; display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; }
.main-content { flex: 1; margin-left: 220px; min-width: 0; }

/* ===== Sidebar ===== */
.sidebar-logo { padding: 20px 24px; border-bottom: 1px solid #2a2f38; }
.sidebar-logo h2 { color: #fff; font-size: 18px; font-weight: 600; letter-spacing: 1px; }
.sidebar-logo span { color: #409eff; }
.sidebar-logo p { color: #666; font-size: 12px; margin-top: 4px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { margin-bottom: 8px; }
.nav-section-title { padding: 12px 24px 8px; font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 1px; }
.nav-item { display: flex; align-items: center; padding: 10px 24px; color: #c9cdd4; font-size: 14px; transition: all .2s; cursor: pointer; }
.nav-item:hover { background: #2a2f38; color: #fff; }
.nav-item.active { background: #409eff; color: #fff; }
.nav-item .nav-icon { width: 20px; margin-right: 12px; font-size: 16px; text-align: center; }
.nav-item .nav-badge { margin-left: auto; background: #e74c3c; color: #fff; padding: 1px 6px; border-radius: 10px; font-size: 11px; }
.nav-sub { padding-left: 56px; }
.nav-sub .nav-item { padding: 8px 24px; font-size: 13px; }
.nav-sub .nav-item::before { content: ''; width: 5px; height: 5px; background: #555; border-radius: 50%; margin-right: 8px; flex-shrink: 0; }

.sidebar-user { padding: 16px 24px; border-top: 1px solid #2a2f38; display: flex; align-items: center; gap: 10px; }
.sidebar-user .avatar { width: 32px; height: 32px; background: #409eff; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; }
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { color: #fff; font-size: 13px; }
.sidebar-user .user-role { color: #666; font-size: 11px; }

/* ===== Header ===== */
.page-header { background: #fff; padding: 16px 28px; border-bottom: 1px solid #e4e7ed; display: flex; align-items: center; justify-content: space-between; }
.page-header h1 { font-size: 18px; font-weight: 600; color: #303133; }
.page-header .header-actions { display: flex; gap: 12px; align-items: center; }

/* ===== Page Content ===== */
.page-content { padding: 24px 28px; }

/* ===== Cards ===== */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-header { padding: 16px 20px; border-bottom: 1px solid #ebeef5; display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 600; color: #303133; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid #ebeef5; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-card .stat-label { color: #909399; font-size: 13px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #303133; }
.stat-card .stat-change { font-size: 12px; margin-top: 8px; }
.stat-card .stat-change.up { color: #67c23a; }
.stat-card .stat-change.down { color: #f56c6c; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 20px; border-radius: 4px; font-size: 14px; transition: all .2s; gap: 6px; }
.btn-primary { background: #409eff; color: #fff; }
.btn-primary:hover { background: #337ecc; }
.btn-success { background: #67c23a; color: #fff; }
.btn-success:hover { background: #529b2e; }
.btn-danger { background: #f56c6c; color: #fff; }
.btn-danger:hover { background: #e04444; }
.btn-warning { background: #e6a23c; color: #fff; }
.btn-default { background: #fff; color: #606266; border: 1px solid #dcdfe6; }
.btn-default:hover { color: #409eff; border-color: #409eff; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 10px 28px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Tables ===== */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #ebeef5; }
table th { background: #fafafa; color: #909399; font-weight: 500; font-size: 13px; white-space: nowrap; }
table td { color: #606266; font-size: 13px; }
table tbody tr:hover { background: #f5f7fa; }
.table-actions { display: flex; gap: 8px; }

/* ===== Tags/Badges ===== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; }
.tag-blue { background: #ecf5ff; color: #409eff; }
.tag-green { background: #f0f9eb; color: #67c23a; }
.tag-red { background: #fef0f0; color: #f56c6c; }
.tag-orange { background: #fdf6ec; color: #e6a23c; }
.tag-gray { background: #f4f4f5; color: #909399; }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: #606266; font-weight: 500; }
.form-group .form-hint { font-size: 12px; color: #909399; margin-top: 4px; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }
input.form-control, select.form-control, textarea.form-control { width: 100%; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 8px; width: 90%; max-width: 600px; max-height: 80vh; overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,.15); }
.modal-lg { max-width: 900px; }
.modal-header { padding: 16px 24px; border-bottom: 1px solid #ebeef5; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: none; font-size: 18px; color: #909399; cursor: pointer; }
.modal-close:hover { background: #f0f0f0; color: #333; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #ebeef5; display: flex; justify-content: flex-end; gap: 12px; }

/* ===== Landing Page Cards Grid ===== */
.lp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.lp-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: box-shadow .2s; }
.lp-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.lp-card-preview { height: 160px; background: #f0f2f5; display: flex; align-items: center; justify-content: center; color: #909399; font-size: 13px; position: relative; overflow: hidden; }
.lp-card-preview img { width: 100%; height: 100%; object-fit: cover; }
.lp-card-preview .style-badge { position: absolute; top: 8px; left: 8px; }
.lp-card-body { padding: 14px 16px; }
.lp-card-body h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.lp-card-body .meta { font-size: 12px; color: #909399; display: flex; gap: 12px; }
.lp-card-footer { padding: 10px 16px; border-top: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }

/* ===== Landing Page Editor ===== */
.lp-editor { display: flex; gap: 24px; }
.lp-editor-sidebar { width: 320px; flex-shrink: 0; }
.lp-editor-preview { flex: 1; }
.phone-frame { width: 393px; max-height: 852px; margin: 0 auto; border: 8px solid #333; border-radius: 24px; overflow: hidden; background: #fff; }
.phone-frame .phone-header { padding: 8px 16px; text-align: center; background: #fff; color: #333; font-size: 12px; border-bottom: 1px solid #eee; }
.phone-frame .phone-body { min-height: 700px; max-height: 820px; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.phone-frame .chat-bubble { padding: 8px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5; max-width: 85%; }
.phone-frame .chat-bubble.left { background: #f0f0f0; align-self: flex-start; border-bottom-left-radius: 2px; }
.phone-frame .chat-bubble.right { background: #409eff; color: #fff; align-self: flex-end; border-bottom-right-radius: 2px; }
.phone-frame .chat-image { width: 100%; border-radius: 8px; }
.phone-frame .reply-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-end; }
.phone-frame .reply-btn { padding: 6px 14px; border: 1px solid #409eff; color: #409eff; border-radius: 18px; font-size: 13px; background: #fff; cursor: pointer; }
.phone-frame .cta-button { display: block; width: 100%; padding: 12px; background: #409eff; color: #fff; text-align: center; border-radius: 4px; font-size: 14px; cursor: pointer; }
.phone-frame .lead-form { padding: 16px; background: #fff; border-radius: 8px; border: 1px solid #eee; }
.phone-frame .lead-form input { width: 100%; margin-bottom: 10px; padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
.phone-frame .keyword-input { padding: 10px; border: 1px solid #409eff; border-radius: 4px; text-align: center; color: #409eff; font-size: 13px; }

/* ===== Tabs ===== */
.tabs { display: flex; border-bottom: 2px solid #e4e7ed; margin-bottom: 20px; }
.tab-item { padding: 10px 20px; font-size: 14px; color: #606266; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; }
.tab-item:hover { color: #409eff; }
.tab-item.active { color: #409eff; border-bottom-color: #409eff; font-weight: 500; }

/* ===== Steps / Wizard ===== */
.steps { display: flex; margin-bottom: 32px; }
.step { flex: 1; text-align: center; position: relative; }
.step::after { content: ''; position: absolute; top: 16px; left: 60%; width: 80%; height: 2px; background: #e4e7ed; }
.step:last-child::after { display: none; }
.step-icon { width: 32px; height: 32px; border-radius: 50%; background: #e4e7ed; color: #909399; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.step.active .step-icon { background: #409eff; color: #fff; }
.step.done .step-icon { background: #67c23a; color: #fff; }
.step-title { font-size: 13px; color: #909399; }
.step.active .step-title { color: #303133; font-weight: 500; }

/* ===== Switch ===== */
.switch { position: relative; display: inline-block; width: 44px; height: 22px; }
.switch input { display: none; }
.switch .slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #dcdfe6; border-radius: 22px; cursor: pointer; transition: .3s; }
.switch .slider::before { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .3s; }
.switch input:checked + .slider { background: #409eff; }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: #909399; }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.empty-state p { margin-bottom: 16px; }

/* ===== Charts ===== */
.chart-container { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.chart-container canvas { width: 100% !important; height: 300px !important; }

/* ===== Filter Bar ===== */
.filter-bar { background: #fff; padding: 16px 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .form-group { margin-bottom: 0; }

/* ===== Auth Pages ===== */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1d2129 0%, #2d3748 100%); }
.auth-card { background: #fff; border-radius: 12px; padding: 40px; width: 400px; max-width: 90vw; box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.auth-card h2 { text-align: center; margin-bottom: 8px; font-size: 22px; color: #303133; }
.auth-card .subtitle { text-align: center; color: #909399; margin-bottom: 28px; font-size: 13px; }
.auth-card .form-group { margin-bottom: 20px; }
.auth-card input { width: 100%; padding: 10px 14px; }
.auth-card .btn { width: 100%; padding: 12px; margin-top: 8px; }
.auth-card .auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: #909399; }
.auth-card .auth-footer a { color: #409eff; }
.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; }
.alert-danger { background: #fef0f0; color: #f56c6c; border: 1px solid #fde2e2; }
.alert-success { background: #f0f9eb; color: #67c23a; border: 1px solid #e1f3d8; }
.alert-info { background: #f4f4f5; color: #909399; border: 1px solid #e9e9eb; }

/* ===== Style Selector ===== */
.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.style-card { background: #fff; border: 2px solid #ebeef5; border-radius: 12px; padding: 30px 20px; text-align: center; cursor: pointer; transition: all .2s; }
.style-card:hover { border-color: #409eff; box-shadow: 0 4px 12px rgba(64,158,255,.15); }
.style-card.selected { border-color: #409eff; background: #ecf5ff; }
.style-card .style-icon { font-size: 36px; margin-bottom: 12px; display: block; }
.style-card .style-name { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.style-card .style-desc { font-size: 12px; color: #909399; line-height: 1.5; }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .style-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .nav-item span, .sidebar .nav-section-title, .sidebar .user-info, .sidebar-logo p { display: none; }
    .main-content { margin-left: 60px; }
    .lp-editor { flex-direction: column; }
    .lp-editor-sidebar { width: 100%; }
}


/* Remember checkbox */
.remember-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.remember-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}
.remember-checkbox label {
    font-size: 14px;
    color: #606266;
    cursor: pointer;
    margin: 0;
    line-height: 1;
}
