/* ===== 全局样式 ===== */
body {
    background-color: #0a0a2a;
    color: #e0e0ff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

/* ===== 导航栏 ===== */
.navbar-dark.bg-dark-glow {
    background: linear-gradient(90deg, #0a0a2a 0%, #1a1a4a 100%);
    border-bottom: 1px solid #00f0ff;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}
.navbar-brand {
    color: #00f0ff !important;
    text-shadow: 0 0 10px #00f0ff;
    font-weight: bold;
}
.nav-link {
    color: #b0b0ff !important;
    transition: 0.3s;
}
.nav-link:hover {
    color: #00f0ff !important;
    text-shadow: 0 0 8px #00f0ff;
}
.dropdown-menu {
    background-color: #1a1a4a !important;
    border: 1px solid #2a2a6a !important;
}
.dropdown-item {
    color: #e0e0ff !important;
}
.dropdown-item:hover {
    background-color: #2a2a6a !important;
    color: #00f0ff !important;
}

/* ===== 卡片 ===== */
.card, .modal-content {
    background-color: #12123a;
    border: 1px solid #2a2a6a;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 100, 255, 0.1);
    color: #e0e0ff;
}
.card-header {
    background-color: #1a1a4a;
    border-bottom: 1px solid #2a2a6a;
    color: #00f0ff;
    font-weight: 600;
}
.neon-card {
    border: 1px solid #00f0ff;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
}
.stat-card {
    text-align: center;
    background: linear-gradient(145deg, #0a0a2a, #1a1a4a);
    border: 1px solid #2a2a6a;
    transition: transform 0.2s;
}
.stat-card:hover {
    transform: scale(1.02);
    border-color: #00f0ff;
}
.stat-card .display-4 {
    color: #00f0ff;
    text-shadow: 0 0 20px #00f0ff;
}

/* ===== 表单控件 ===== */
.form-control, .form-select {
    background-color: #0a0a2a !important;
    border: 1px solid #3a3a7a !important;
    color: #ffffff !important;
}
.form-control:focus, .form-select:focus {
    background-color: #0a0a2a !important;
    border-color: #00f0ff !important;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
    color: #ffffff !important;
}
.neon-input {
    background-color: #0a0a2a !important;
    border: 1px solid #3a3a7a !important;
    color: #ffffff !important;
}
.neon-input:focus {
    border-color: #00f0ff !important;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

/* ===== 按钮 ===== */
.btn-primary {
    background: linear-gradient(45deg, #0a0a2a, #1a1a6a);
    border: 1px solid #00f0ff;
    color: #00f0ff;
    transition: 0.3s;
}
.btn-primary:hover {
    background: #00f0ff;
    color: #0a0a2a;
    box-shadow: 0 0 30px #00f0ff;
}
.btn-success {
    background: linear-gradient(45deg, #0a2a0a, #1a6a1a);
    border: 1px solid #00ff80;
    color: #00ff80;
}
.btn-success:hover {
    background: #00ff80;
    color: #0a0a2a;
    box-shadow: 0 0 30px #00ff80;
}
.btn-danger {
    background: linear-gradient(45deg, #2a0a0a, #6a1a1a);
    border: 1px solid #ff0040;
    color: #ff0040;
}
.btn-danger:hover {
    background: #ff0040;
    color: #0a0a2a;
    box-shadow: 0 0 30px #ff0040;
}
.btn-outline-info, .btn-outline-danger, .btn-outline-success, .btn-outline-secondary {
    border-color: #3a3a7a;
    color: #b0b0ff;
}
.btn-outline-info:hover {
    background: #00f0ff;
    color: #0a0a2a;
    border-color: #00f0ff;
}
.btn-outline-danger:hover {
    background: #ff0040;
    color: #0a0a2a;
    border-color: #ff0040;
}
.btn-outline-success:hover {
    background: #00ff80;
    color: #0a0a2a;
    border-color: #00ff80;
}
.btn-outline-secondary:hover {
    background: #3a3a7a;
    color: #e0e0ff;
    border-color: #3a3a7a;
}

/* ===== 表格 ===== */
.table-dark {
    background-color: #0a0a2a;
    color: #e0e0ff;
    border-color: #1a1a4a;
}
.table-dark th {
    color: #00f0ff;
    border-bottom: 2px solid #00f0ff;
}
.table-dark td {
    border-color: #1a1a4a;
}
.table-responsive {
    border-radius: 12px;
    overflow-x: auto;
}

/* ===== 徽章 ===== */
.badge.bg-success {
    background-color: #00ff80 !important;
    color: #0a0a2a;
}
.badge.bg-danger {
    background-color: #ff0040 !important;
    color: #ffffff;
}
.badge.bg-secondary {
    background-color: #3a3a7a !important;
}
.badge.bg-info {
    background-color: #00f0ff !important;
    color: #0a0a2a;
}

/* ===== 警示框 ===== */
.alert {
    background-color: #12123a;
    border-color: #00f0ff;
    color: #e0e0ff;
}
.alert-danger {
    border-color: #ff0040;
}
.alert-success {
    border-color: #00ff80;
}

/* ===== 模态框 ===== */
.modal-content {
    background-color: #12123a;
}
.modal-header, .modal-footer {
    border-color: #2a2a6a;
}
/* 移动端模态框：内容超高时可滚动，避免按钮被裁切而点不到（尤其用户编辑弹窗带权限网格） */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem auto;
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
    }
    .modal-content {
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== 二维码 ===== */
.qr-code img {
    background: #0a0a2a;
    padding: 10px;
    border-radius: 10px;
}

/* ===== 权限复选框网格 ===== */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

/* ===== 移动端适配（重点） ===== */
@media (max-width: 768px) {
    /* 全局按钮放大 */
    .btn {
        font-size: 1.1rem;
        padding: 0.6rem 1rem;
    }
    .btn-sm {
        font-size: 1rem;
        padding: 0.4rem 0.8rem;
    }
    /* 表格字体和间距 */
    .table td, .table th {
        font-size: 0.9rem;
        padding: 0.3rem 0.2rem;
    }
    /* 卡片内边距 */
    .card-body {
        padding: 0.8rem;
    }
    .modal-dialog {
        margin: 0.5rem;
    }
    /* 导航品牌 */
    .navbar-brand {
        font-size: 1.2rem;
    }
    /* 统计卡片数字 */
    .stat-card .display-4 {
        font-size: 2.5rem;
    }
    /* 扫码按钮适配 */
    .scan-btn {
        font-size: 1.2rem;
        padding: 0.8rem;
    }
    /* 权限复选框网格改为单列 */
    .permission-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    /* 超小屏进一步优化 */
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    .table td, .table th {
        font-size: 0.8rem;
        padding: 0.2rem 0.1rem;
    }
    .btn {
        font-size: 0.95rem;
        padding: 0.5rem 0.8rem;
    }
    .btn-sm {
        font-size: 0.85rem;
        padding: 0.3rem 0.6rem;
    }
    .stat-card .display-4 {
        font-size: 2rem;
    }
    .card-header {
        font-size: 0.95rem;
    }
}

/* 手机端按钮优化 */
@media (max-width: 576px) {
    .btn-sm {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.4rem !important;
        white-space: nowrap !important;
    }
    .table td, .table th {
        font-size: 0.75rem;
    }
    .btn-success, .btn-danger {
        min-width: 0;
    }
}

/* ===== 备案信息页脚 ===== */
.site-footer {
    margin-top: 2rem;
    border-top: 1px solid #2a2a6a;
    background: linear-gradient(90deg, #0a0a2a 0%, #1a1a4a 100%);
}
.beian-link {
    color: #8a8aff !important;
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.3s;
}
.beian-link:hover {
    color: #00f0ff !important;
    text-shadow: 0 0 8px #00f0ff;
}

/* 全屏扫码样式已内联到 base.html（#scanOverlay 区域），此处不再重复，避免漏传文件导致非全屏 */
