/* ============================================
   九宫格导航站 - 全局样式
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f6ef7;
    --primary-dark: #3b55d9;
    --danger: #e74c3c;
    --success: #27ae60;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e1e8ed;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 8px 24px rgba(79, 110, 247, 0.18);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================
   前台 - 九宫格索引页
   ============================================ */
.index-page .container {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 20px;
}

.site-header {
    text-align: center;
    margin-bottom: 40px;
}

.site-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary), #7c5cfc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-desc {
    color: var(--text-light);
    font-size: 15px;
}

/* 九宫格 */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 640px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
}

@media (max-width: 380px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px 16px;
    box-shadow: var(--shadow);
    transition: all 0.25s ease;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(79, 110, 247, 0.2);
    color: var(--primary);
}

.card-icon {
    width: 128px;
    height: 128px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-icon .letter {
    color: #fff;
    font-size: 28px;
    font-weight: 700;
}

.card-name {
    font-size: 15px;
    font-weight: 500;
    text-align: center;
}

/* 空状态 */
.empty-tip {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

/* 页脚 */
.site-footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* 关注我们 */
.follow-us {
    margin-bottom: 16px;
}
.follow-title {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 14px;
}
.follow-buttons {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}
.follow-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 22px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.follow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
    color: #fff;
}
.follow-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    display: inline-block;
}
.follow-douyin {
    background: #000;
}
.follow-douyin:hover {
    background: #1a1a1a;
}
.follow-kuaishou {
    background: #ff6a00;
}
.follow-kuaishou:hover {
    background: #ff7a1a;
}

.admin-link {
    font-size: 13px;
    color: var(--text-light);
}

/* ============================================
   后台 - 登录页
   ============================================ */
.login-box {
    max-width: 380px;
    margin: 80px auto;
    background: var(--card-bg);
    padding: 36px 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 22px;
}

.login-tip {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-light);
}

/* ============================================
   后台 - 管理页
   ============================================ */
.admin-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 {
    font-size: 24px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.panel h3 {
    font-size: 17px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* 表单 */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group .req {
    color: var(--danger);
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group input[type="password"] {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: #fff;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.1);
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 24px;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    padding: 11px;
}

/* 提示框 */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert.error {
    background: #fdecea;
    color: var(--danger);
    border: 1px solid #f5c6cb;
}

.alert.success {
    background: #e8f8f0;
    color: var(--success);
    border: 1px solid #b7e4c7;
}

/* 表格 */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f8f9fb;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
}

.data-table tr:hover {
    background: #f8f9fb;
}

.url-cell {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-cell a {
    font-size: 13px;
}

/* 迷你图标 */
.mini-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.mini-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-icon span {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

/* 状态徽章 */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    text-decoration: none;
}

.badge-on {
    background: #e8f8f0;
    color: var(--success);
}

.badge-off {
    background: #f1f3f5;
    color: var(--text-light);
}

/* 响应式 */
@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
