/* 小招助手管理后台 - 样式 */

:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --dark: #2c3e50;
    --gray: #95a5a6;
    --light: #ecf0f1;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f6fa;
    color: var(--dark);
    line-height: 1.6;
}

/* 登录页 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--dark);
}

.login-box h1::before {
    content: "🛠️ ";
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-secondary {
    background: var(--gray);
    color: var(--white);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* 后台布局 */
.admin-container {
    display: none;
    height: 100vh;
    overflow: hidden;
}

.admin-container.active {
    display: flex;
    flex-direction: column;
}

/* 顶部导航 */
.top-bar {
    background: var(--white);
    padding: 15px 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.top-bar h1 {
    font-size: 20px;
    color: var(--dark);
}

.top-bar h1::before {
    content: "🛠️ ";
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: var(--gray);
}

.logout-btn {
    background: var(--danger);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
}

/* 主布局 - 内容区左侧，菜单右侧 */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 内容区域 - 左侧，可滚动 */
.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #f5f6fa;
}

/* 侧边导航 */
.sidebar {
    width: 200px;
    background: var(--white);
    min-height: calc(100vh - 60px);
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    padding: 15px 20px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.3s;
}

.nav-item:hover {
    background: var(--light);
}

.nav-item.active {
    background: var(--light);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 500;
}

/* 内容区域 */
.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #f5f6fa;
}

/* 自定义滚动条样式 */
.content::-webkit-scrollbar {
    width: 8px;
}

.content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 24px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: bold;
    color: var(--dark);
}

.stat-card.online .value {
    color: var(--success);
}

/* 数据表格 */
.data-table {
    width: 100%;
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: var(--light);
    font-weight: 500;
    color: var(--dark);
}

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

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.status-online {
    background: #d4edda;
    color: #155724;
}

.status-online::before {
    content: "🟢 ";
}

.status-offline {
    background: #f8d7da;
    color: #721c24;
}

.status-offline::before {
    content: "🔴 ";
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-success::before {
    content: "✓ ";
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

.status-failed::before {
    content: "✗ ";
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.role-admin {
    background: #fff3cd;
    color: #856404;
}

.role-user {
    background: #e2e3e5;
    color: #383d41;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btns button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.action-btns .edit-btn {
    background: var(--warning);
    color: var(--white);
}

.action-btns .delete-btn {
    background: var(--danger);
    color: var(--white);
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* JSON编辑器 */
.json-editor {
    width: 100%;
    min-height: 300px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 13px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
}

/* 筛选器 */
.filters {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.filters select,
.filters input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* 详情弹窗 */
.detail-content {
    font-size: 14px;
}

.detail-row {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.detail-label {
    width: 120px;
    color: var(--gray);
    flex-shrink: 0;
}

.detail-value {
    flex: 1;
    word-break: break-all;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray);
}

/* 响应式 */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar {
        width: 60px;
    }

    .nav-item span {
        display: none;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }
}

/* 快捷入口 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 30px;
}

.quick-btn {
    background: var(--white);
    border: none;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.quick-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.quick-btn .icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.quick-btn .label {
    font-size: 14px;
    color: var(--dark);
}

/* 版本卡片 */
.version-card {
    background: var(--white);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.version-info h4 {
    margin-bottom: 5px;
}

.version-info p {
    color: var(--gray);
    font-size: 13px;
}

.version-actions {
    display: flex;
    gap: 10px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: var(--white);
    border-radius: 5px;
    cursor: pointer;
}

.pagination button.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* 错误提示 */
.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-top: 5px;
}

/* 成功提示 */
.success-msg {
    color: var(--success);
    font-size: 13px;
    margin-top: 5px;
}

/* ���ù��� - ������Ƭ */
.config-card {
    background: var(--white);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.config-card .card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    margin: 10px 0;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.hint {
    color: var(--warning);
    font-size: 13px;
    margin-top: 5px;
}

.time-slots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.time-slot label {
    display: block;
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 5px;
}

.time-slot input[type="time"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.mt-2 {
    margin-top: 10px;
}

/* Toast 消息提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
}

.toast.error {
    background: rgba(231, 76, 60, 0.95);
}

.toast.success {
    background: rgba(46, 204, 113, 0.95);
}

/* 模式选择 Tab */
.mode-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    background: #fafbfc;
}

.mode-tab {
    flex: 1;
    padding: 14px 20px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.mode-tab:hover {
    color: var(--dark);
    background: #f0f2f5;
}

.mode-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--white);
}

.mode-panel {
    display: none;
    padding: 20px;
}

.mode-panel.active {
    display: block;
}

/* 保存按钮脏数据状态 */
.btn-dirty {
    background: var(--success) !important;
    color: var(--white);
}
