/* ========== 基础重置 ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: #1890ff; text-decoration: none; }
a:hover { color: #40a9ff; }

/* ========== 登录页 ========== */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: #fff;
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
}

.login-title {
    font-size: 24px;
    text-align: center;
    color: #333;
}

.login-subtitle {
    font-size: 16px;
    text-align: center;
    color: #999;
    margin-bottom: 30px;
    font-weight: normal;
}

.login-form { margin-top: 20px; }

/* ========== 管理后台布局 ========== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #001529;
    color: #fff;
    flex-shrink: 0;
    min-height: 100vh;
}

.sidebar-brand {
    padding: 20px;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid rgba(255,255,255,.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,.65);
    transition: all .3s;
    border-left: 3px solid transparent;
}

.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: #1890ff; border-left-color: #1890ff; }

.main-content {
    flex: 1;
    padding: 24px;
    background: #f0f2f5;
    overflow-y: auto;
}

.page-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #1890ff;
}

.stat-label {
    font-size: 14px;
    color: #999;
    margin-top: 4px;
}

/* ========== 卡片 ========== */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid #f0f0f0;
}

.card-body { padding: 20px; }

/* ========== 表单 ========== */
.form { max-width: 600px; }

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color .3s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,.2);
}

.form-hint {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.required { color: #ff4d4f; }

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all .3s;
    text-align: center;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover { background: #40a9ff; }

.btn-danger {
    background: #ff4d4f;
    color: #fff;
}

.btn-danger:hover { background: #ff7875; }

.btn-sm { padding: 4px 12px; font-size: 12px; }

.btn-block {
    display: block;
    width: 100%;
    padding: 10px;
    font-size: 16px;
}

/* ========== 提示 ========== */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.alert-success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #52c41a;
}

.alert-error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
}

/* ========== 表格 ========== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th, .table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.table th {
    background: #fafafa;
    font-weight: 600;
    color: #555;
}

.table tbody tr:hover { background: #fafafa; }

.url-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.page-link {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    color: #333;
    font-size: 14px;
}

.page-link:hover { border-color: #1890ff; color: #1890ff; }
.page-link.active { background: #1890ff; color: #fff; border-color: #1890ff; }

/* ========== 前台公共页面 ========== */
.public-layout {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.public-header {
    text-align: center;
    margin-bottom: 30px;
}

.public-header h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 8px;
}

.public-header p {
    color: #999;
    font-size: 14px;
}

.public-main { flex: 1; }

.public-footer {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #e8e8e8;
}

/* ========== 结果展示 ========== */
.result-box {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.result-label {
    font-size: 16px;
    font-weight: bold;
    color: #52c41a;
    margin-bottom: 10px;
}

.result-url {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.result-url input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.result-hint {
    margin-top: 10px;
    color: #faad14;
    font-size: 13px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .sidebar { width: 100%; min-height: auto; }
    .main-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .public-layout { padding: 20px 12px; }
    .table { font-size: 12px; }
    .table th, .table td { padding: 8px 6px; }
    .form-row { flex-direction: column; }
    .qr-modal { width: 95%; padding: 20px; }
}

/* ========== 表单单行双列 ========== */
.form-row {
    display: flex;
    gap: 16px;
}

.form-half {
    flex: 1;
}

/* ========== 图片上传 ========== */
.upload-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.upload-preview {
    width: 80px;
    height: 80px;
    border: 1px dashed #d9d9d9;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    background: #fafafa;
}

.upload-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.upload-preview span {
    font-size: 12px;
    color: #bbb;
}

.upload-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-status {
    font-size: 13px;
}

/* ========== 二维码弹窗 ========== */
.qr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.qr-modal {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    text-align: center;
    max-width: 90%;
}

.qr-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: bold;
}

.qr-modal-close {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.qr-modal-close:hover { color: #333; }

.qr-modal-url {
    color: #666;
    font-size: 13px;
    margin-top: 12px;
    word-break: break-all;
}

/* ========== 验证码 ========== */
.captcha-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ========== 编辑弹窗 ========== */
.edit-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.edit-modal {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    max-width: 500px;
    width: 90%;
}

.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: bold;
}

.edit-modal-close {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}
.edit-modal-close:hover { color: #333; }
