/* 问卷星PHP系统 - 后台管理样式 */
:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --bg: #f0f2f5;
    --sidebar-width: 220px;
    --topbar-height: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; background: var(--bg); color: #333; font-size: 14px; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== Layout ===== */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: #001529; color: #fff; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; transition: width 0.3s; }
.sidebar-logo { padding: 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo h2 { font-size: 18px; font-weight: 600; }
.sidebar-nav { padding: 10px 0; }
.nav-item { display: flex; align-items: center; padding: 12px 24px; color: rgba(255,255,255,0.65); transition: all 0.2s; font-size: 14px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-item.active { color: #fff; background: var(--primary); }
.nav-icon { margin-right: 10px; font-size: 16px; }

.main-area { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-height); background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 50; }
.topbar h3 { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 15px; }
.user-info { font-size: 14px; color: #666; }

.content { padding: 24px; flex: 1; }

/* ===== Login ===== */
.login-page { background: linear-gradient(135deg, #667eea, #764ba2); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: #fff; border-radius: 12px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-header { text-align: center; margin-bottom: 30px; }
.login-header h1 { font-size: 24px; color: #333; margin-bottom: 5px; }
.login-header p { color: #999; font-size: 14px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-size: 14px; margin-bottom: 6px; font-weight: 500; }
.login-form input { width: 100%; padding: 12px; border: 1px solid #d9d9d9; border-radius: 8px; font-size: 15px; transition: all 0.2s; }
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(24,144,255,0.2); }

/* ===== Common Components ===== */
.btn { display: inline-block; padding: 8px 20px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; transition: all 0.2s; text-align: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-default { background: #fff; color: #333; border: 1px solid #d9d9d9; }
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-sm, .btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 4px; cursor: pointer; border: 1px solid #d9d9d9; background: #fff; color: #333; text-decoration: none; display: inline-block; margin: 2px; }
.btn-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm.btn-success { border-color: var(--success); color: var(--success); }
.btn-sm.btn-warning { border-color: var(--warning); color: var(--warning); }
.btn-sm.btn-danger { border-color: var(--danger); color: var(--danger); }

.card { background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; justify-content: space-between; }
.card-header h3, .card-header h4 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; margin-bottom: 6px; font-weight: 500; color: #333; }
.form-input, .form-select { width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; transition: border-color 0.2s; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(24,144,255,0.2); }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }
.alert-error { background: #fff2f0; border: 1px solid #ffccc7; color: #ff4d4f; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.table th { background: #fafafa; font-weight: 600; color: #666; }
.table tr:hover { background: #fafafa; }

/* ===== Dashboard Stats ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.stat-value { font-size: 28px; font-weight: 700; color: #333; }
.stat-label { font-size: 13px; color: #999; }

.row { display: flex; gap: 20px; }
.col-8 { flex: 0 0 66.666%; }
.col-4 { flex: 0 0 33.333%; }

/* ===== Survey Grid ===== */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.search-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.survey-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.survey-card { background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); padding: 20px; transition: box-shadow 0.2s; }
.survey-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.survey-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.survey-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.survey-desc { font-size: 13px; color: #999; margin-bottom: 10px; }
.survey-meta { display: flex; justify-content: space-between; font-size: 12px; color: #999; margin-bottom: 12px; }
.survey-actions { display: flex; flex-wrap: wrap; gap: 4px; }

.status-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; color: #fff; }
.category-tag { font-size: 12px; color: var(--primary); background: #e6f7ff; padding: 2px 8px; border-radius: 4px; }
.q-type-tag { font-size: 11px; color: #999; background: #f0f0f0; padding: 1px 6px; border-radius: 3px; margin-left: 8px; }
.response-count { font-size: 13px; color: #999; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 20px; }
.page-btn { padding: 6px 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; color: #333; text-decoration: none; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Templates ===== */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.template-card { background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden; transition: box-shadow 0.2s; }
.template-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.template-cover { padding: 30px 20px; color: #fff; position: relative; }
.template-cover h3 { font-size: 18px; }
.template-badge { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.template-body { padding: 20px; }
.template-body p { font-size: 14px; color: #666; margin-bottom: 10px; }
.template-meta { display: flex; justify-content: space-between; font-size: 12px; color: #999; margin-bottom: 12px; }

/* ===== Stats ===== */
.stats-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.stats-header h2 { font-size: 20px; }
.stats-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-mini { background: #fff; border-radius: 8px; padding: 16px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.stat-mini strong { display: block; font-size: 24px; color: var(--primary); }
.stat-mini span { font-size: 13px; color: #999; }

.bar-chart { padding: 10px 0; }
.bar-row { display: flex; align-items: center; margin-bottom: 8px; }
.bar-label { width: 120px; font-size: 13px; text-align: right; padding-right: 12px; flex-shrink: 0; }
.bar-track { flex: 1; height: 24px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.5s ease; min-width: 2px; }
.bar-value { width: 80px; text-align: right; font-size: 13px; color: #666; flex-shrink: 0; }

.rating-stats { text-align: center; padding: 20px; }
.big-number { font-size: 48px; font-weight: 700; color: var(--primary); }

.text-answers { max-height: 300px; overflow-y: auto; }
.answer-item { padding: 8px 12px; background: #fafafa; border-radius: 4px; margin-bottom: 6px; font-size: 13px; line-height: 1.5; }
.more-answers { text-align: center; color: #999; font-size: 12px; padding: 8px; }

/* ===== Settings ===== */
.settings-form { max-width: 600px; }
.settings-form .form-input { max-width: 400px; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-icon { font-size: 64px; margin-bottom: 15px; }
.empty-state h3 { font-size: 18px; color: #666; margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo h2 { display: none; }
    .nav-item span:not(.nav-icon) { display: none; }
    .nav-item { justify-content: center; padding: 12px; }
    .main-area { margin-left: 60px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-overview { grid-template-columns: repeat(2, 1fr); }
    .row { flex-direction: column; }
    .col-8, .col-4 { flex: 100%; }
    .survey-grid { grid-template-columns: 1fr; }
}
