/* Web管理后台样式 */

/* ============ 基础样式 ============ */
:root {
    --sidebar-width: 250px;
    --sidebar-dark: #343a40;
    --sidebar-darker: #2c3136;
    --primary-color: #4e73df;
    --success-color: #1cc88a;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --info-color: #36b9cc;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fc;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ============ 加载覆盖层 ============ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ============ 登录页面 ============ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: #fff;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    font-size: 3rem;
    color: var(--primary-color);
}

.login-header h2 {
    margin-top: 1rem;
    color: #5a5c69;
    font-weight: 700;
}

.login-form .form-label {
    font-weight: 600;
    color: #5a5c69;
}

.login-form .input-group-text {
    background: #f8f9fc;
    border-right: none;
}

.login-form .form-control {
    border-left: none;
}

.login-form .form-control:focus {
    border-color: #bac8f3;
    box-shadow: none;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e3e6f0;
}

/* ============ 主界面布局 ============ */
.main-container {
    display: flex;
    min-height: 100vh;
}

/* ============ 顶部导航栏 ============ */
.navbar-dark.bg-dark {
    background: linear-gradient(180deg, var(--sidebar-dark) 10%, var(--sidebar-darker) 100%) !important;
    padding: 0.75rem 1rem;
    height: 56px;
}

.navbar-brand {
    font-weight: 700;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

.nav-link.dropdown-toggle {
    color: rgba(255, 255, 255, 0.9) !important;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

/* 手机端菜单按钮 - 默认隐藏 */
.mobile-toggle-btn {
    display: none;
    padding: 0.25rem 0.5rem;
    color: #fff;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    cursor: pointer;
    margin-right: 0.5rem;
}

/* ============ 侧边栏 ============ */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 56px);
    background: linear-gradient(180deg, var(--sidebar-dark) 10%, var(--sidebar-darker) 100%);
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 0.5rem;
    display: flex;
    justify-content: flex-end;
}

.sidebar-header .btn-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.25rem 0.5rem;
}

.sidebar .nav {
    padding: 0;
}

.sidebar .nav-item {
    margin: 0.25rem 0;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0;
    transition: all 0.2s;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: #fff;
    background: var(--primary-color);
}

.sidebar .nav-link i {
    width: 1.25rem;
    font-size: 1rem;
    text-align: center;
}

.sidebar-collapsed {
    width: 60px;
}

.sidebar-collapsed .nav-link span {
    display: none;
}

.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

/* 遮罩层 - 默认隐藏 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

/* ============ 内容区域 ============ */
.content {
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    min-height: calc(100vh - 56px);
    margin-top: 56px;
    transition: margin-left 0.3s ease;
    width: 100%;
}

.content-expanded {
    margin-left: 60px;
}

/* ============ 页面内容 ============ */
.page-content {
    padding: 0;
}

.page-title {
    color: #5a5c69;
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e3e6f0;
}

/* ============ 统计卡片 ============ */
.stat-card {
    border-radius: 0.5rem;
    padding: 1.25rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    position: relative;
    overflow: hidden;
}

.stat-card.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), #224abe);
}

.stat-card.bg-success {
    background: linear-gradient(135deg, var(--success-color), #13855c);
}

.stat-card.bg-info {
    background: linear-gradient(135deg, var(--info-color), #258391);
}

.stat-card.bg-warning {
    background: linear-gradient(135deg, var(--warning-color), #dda20a);
}

.stat-card.bg-danger {
    background: linear-gradient(135deg, var(--danger-color), #be2617);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.stat-info p {
    font-size: 0.8rem;
    margin: 0;
    opacity: 0.9;
}

/* ============ 卡片样式 ============ */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    background: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: #5a5c69;
}

.card-header h6 {
    margin: 0;
    font-size: 0.9rem;
}

.card-body {
    padding: 1.25rem;
}

/* ============ 表格样式 ============ */
.table {
    margin-bottom: 0;
    width: 100%;
}

.table th {
    background: #f8f9fc;
    border-bottom: 2px solid #e3e6f0;
    color: #5a5c69;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table td {
    border-bottom: 1px solid #e3e6f0;
    color: #5a5c69;
    vertical-align: middle;
    padding: 0.875rem 1rem;
}

.table tbody tr:hover {
    background: #f8f9fc;
}

/* 表格链接样式 */
.table a {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
}

.table a:hover {
    text-decoration: underline;
}

/* 表格响应式容器 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 表格操作按钮 */
.table .btn-sm {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* ============ 按钮样式 ============ */
.btn {
    border-radius: 0.35rem;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

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

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

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

/* ============ 分页 ============ */
.pagination {
    margin-bottom: 0;
}

.page-link {
    color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============ 表单 ============ */
.form-label {
    font-weight: 600;
    color: #5a5c69;
    font-size: 0.85rem;
}

.form-control {
    border-radius: 0.35rem;
    border: 1px solid #d1d3e2;
}

.form-control:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

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

.modal-content {
    background: #fff;
    border-radius: 0.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-content .modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-content .modal-title {
    font-weight: 700;
    color: #5a5c69;
}

.modal-content .modal-body {
    padding: 1.25rem;
}

.modal-content .modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e3e6f0;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ============ 标签 ============ */
.badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.35rem;
}

/* ============ 警告框 ============ */
.alert {
    border-radius: 0.5rem;
    border: none;
}

/* ============ 配置项样式 ============ */
.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e3e6f0;
}

.config-item:last-child {
    border-bottom: none;
}

.config-key {
    font-weight: 600;
    color: #5a5c69;
}

.config-value {
    color: #858796;
    font-family: monospace;
    background: #f8f9fc;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============ 操作按钮组 ============ */
.action-btns {
    display: flex;
    gap: 0.25rem;
}

/* ============ 搜索框 ============ */
.search-box {
    max-width: 300px;
}

/* ============ 空状态 ============ */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #858796;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============ 加载状态 ============ */
.loading {
    text-align: center;
    padding: 2rem;
    color: #858796;
}

.loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

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

/* ============ 滚动条 ============ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ============ Toast容器 ============ */
.toast-container {
    z-index: 1100;
}

/* ============ 响应式样式 - 必须放在最后 ============ */
@media (max-width: 768px) {
    /* 手机端菜单按钮显示 */
    .mobile-toggle-btn {
        display: block !important;
    }

    /* 侧边栏默认隐藏到左侧 */
    .sidebar {
        transform: translateX(-100%) !important;
        width: 250px !important;
        z-index: 1050 !important;
    }

    /* 手机端显示侧边栏 */
    .sidebar.mobile-show {
        transform: translateX(0) !important;
    }

    /* 内容区域全宽 */
    .content {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 1rem !important;
    }

    .content-expanded {
        margin-left: 0 !important;
    }

    /* 顶部导航栏紧凑化 */
    .navbar-brand {
        font-size: 0.85rem !important;
    }

    .navbar-brand i {
        display: none !important;
    }

    /* 隐藏桌面端的侧边栏折叠按钮 */
    .sidebar-header {
        display: none !important;
    }

    /* 统计卡片两列布局 */
    .stat-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

    .stat-card .stat-icon {
        font-size: 1.5rem;
    }

    .stat-card .stat-info h3 {
        font-size: 1.25rem;
    }

    .stat-card .stat-info p {
        font-size: 0.7rem;
    }

    /* 卡片紧凑化 */
    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    /* 表格样式调整 */
    .table th, .table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }

    /* 表格链接换行 */
    .table a {
        word-break: break-all;
        font-size: 0.75rem;
    }

    /* 模态框在手机上更宽 */
    .modal-content {
        max-width: 95% !important;
        margin: 0.5rem;
    }

    /* 登录卡片适配 */
    .login-card {
        max-width: 90%;
        padding: 1.5rem;
        margin: 0.5rem;
    }

    /* 搜索框全宽 */
    .search-box {
        max-width: 100% !important;
    }

    /* 页面标题紧凑 */
    .page-title {
        font-size: 1rem !important;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }

    /* 按钮组换行 */
    .action-btns {
        flex-wrap: wrap;
    }
}

/* 桌面端隐藏遮罩层 */
@media (min-width: 769px) {
    .sidebar-overlay {
        display: none !important;
    }
}