/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --主色: #667eea;
    --辅色: #764ba2;
    --成功: #48bb78;
    --危险: #fc8181;
    --警告: #ed8936;
    --文字: #2d3748;
    --边框: #e2e8f0;
    --背景: #f7fafc;
    --圆角: 12px;
    --阴影: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, var(--主色) 0%, var(--辅色) 100%);
    min-height: 100vh;
    color: var(--文字);
}

.header {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    background: white;
    color: var(--主色);
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
.btn-primary {
    background: var(--主色);
    color: white;
}
.btn-danger {
    background: var(--危险);
    color: white;
}
.btn-warning {
    background: var(--警告);
    color: white;
}
.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.page-title {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    font-size: 28px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==================== 前台标签样式 ==================== */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
}

.tag-card {
    background: white;
    border-radius: var(--圆角);
    overflow: hidden;
    box-shadow: var(--阴影);
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.tag-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.tag-image {
    width: 100%;
    height: 100px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    overflow: hidden;
}

.tag-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.tag-card:hover .tag-image img {
    transform: scale(1.1);
}

.tag-info {
    padding: 12px;
    text-align: center;
    background: white;
}

.tag-name {
    font-size: 15px;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-desc {
    font-size: 12px;
    color: #718096;
}

.tag-card:hover .tag-name {
    color: #2d3748;
}

/* ==================== 后台管理样式 ==================== */
.admin-panel {
    background: white;
    border-radius: var(--圆角);
    padding: 25px;
    display: none;
    box-shadow: var(--阴影);
}

.admin-panel.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.security-bar {
    background: #fffbeb;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #fcd34d;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-bottom: 20px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--边框);
    vertical-align: middle;
}

.data-table th {
    background: var(--背景);
    color: #4a5568;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.data-table tr:hover {
    background: #f7fafc;
}

.操作列 {
    white-space: nowrap;
    width: 80px;
}

.操作按钮组 {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.table-img {
    width: 50px;
    height: 50px;
    background: #e2e8f0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
}

.table-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-online {
    background: #c6f6d5;
    color: #22543d;
}
.status-offline {
    background: #fed7d7;
    color: #742a2a;
}

/* ==================== 分页控制栏 ==================== */
.分页栏 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--背景);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.分页信息 {
    color: #4a5568;
    font-size: 14px;
}

.分页控制 {
    display: flex;
    align-items: center;
    gap: 5px;
}

.分页按钮 {
    padding: 6px 12px;
    border: 1px solid var(--边框);
    background: white;
    color: var(--文字);
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
}

.分页按钮:hover:not(:disabled) {
    background: var(--主色);
    color: white;
    border-color: var(--主色);
}

.分页按钮:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.分页按钮.激活 {
    background: var(--主色);
    color: white;
    border-color: var(--主色);
    font-weight: bold;
}

.每页选择 {
    padding: 5px 10px;
    border: 1px solid var(--边框);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* ==================== 模态框 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: var(--圆角);
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--边框);
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
}

.close-x {
    cursor: pointer;
    font-size: 24px;
    color: #a0aec0;
    line-height: 1;
}

.close-x:hover {
    color: var(--危险);
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--文字);
    font-size: 13px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--边框);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--主色);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.upload-box {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: var(--背景);
    position: relative;
}

.upload-box:hover {
    border-color: var(--主色);
    background: #edf2f7;
}

.upload-preview {
    max-width: 100%;
    max-height: 120px;
    border-radius: 6px;
    display: none;
}

.upload-hint {
    color: #718096;
    font-size: 13px;
}

/* ==================== 提示消息 ==================== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    transform: translateX(400px);
    transition: transform 0.3s;
    z-index: 2000;
    border-left: 4px solid var(--成功);
    font-weight: 500;
}

.toast.show {
    transform: translateX(0);
}
.toast.error {
    border-left-color: var(--危险);
}
.toast.warning {
    border-left-color: var(--警告);
}

/* ==================== 加载动画 ==================== */
.loading-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-mask.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--边框);
    border-top-color: var(--主色);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
    }
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .data-table {
        font-size: 12px;
    }
    .data-table th,
    .data-table td {
        padding: 8px;
    }
    .hide-mobile {
        display: none;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .分页栏 {
        flex-direction: column;
        align-items: flex-start;
    }
}