/* 全局样式 */
:root {
  --primary-color: #4e73df;
  --secondary-color: #858796;
  --success-color: #1cc88a;
  --info-color: #36b9cc;
  --warning-color: #f6c23e;
  --danger-color: #e74a3b;
  --light-color: #f8f9fc;
  --dark-color: #5a5c69;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f8f9fc;
  overflow-x: hidden;
}

/* 布局 */
.wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.content-wrapper {
  width: calc(100% - 250px);
  margin-left: 250px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: all 0.3s;
  position: relative;
}

.main-content {
  flex: 1;
  padding: 1.5rem;
  background-color: #f8f9fc;
}

/* 侧边栏 */
.sidebar {
  width: 250px;
  background-color: #4e73df;
  background-image: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
  background-size: cover;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  transition: all 0.3s;
}

.sidebar-header {
  padding: 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.sidebar-toggle {
  cursor: pointer;
  color: #fff;
}

.sidebar-menu {
  padding: 1rem 0;
}

.sidebar-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu li {
  margin-bottom: 0.25rem;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.3s;
}

.sidebar-menu li a:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-menu li.active a {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
  border-left: 4px solid #fff;
}

.sidebar-menu li a i {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
}

/* 导航栏 */
.navbar {
  padding: 0.75rem 1.5rem;
  background-color: #fff;
  box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

/* 页脚 */
.footer {
  padding: 1rem 1.5rem;
  background-color: #fff;
  border-top: 1px solid #e3e6f0;
}

/* 卡片 */
.card {
  border: none;
  border-radius: 0.35rem;
  box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.card-header {
  background-color: #f8f9fc;
  border-bottom: 1px solid #e3e6f0;
}

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    margin-left: -250px;
    z-index: 1050;
  }

  .sidebar.active {
    margin-left: 0;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
  }

  .content-wrapper {
    width: 100% !important;
    margin-left: 0 !important;
    transition: all 0.3s;
  }

  .content-wrapper.active {
    margin-left: 0 !important;
    opacity: 0.8;
  }

  .navbar-toggler {
    display: block;
  }

  .navbar-brand {
    display: block !important;
  }

  /* 添加遮罩层，当侧边栏打开时显示 */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
  }

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

/* 登录页面 */
.login-wrapper {
  width: 100%;
  min-height: 100vh;
}

/* 表格 */
.table-responsive {
  overflow-x: auto;
}

/* 操作日志样式 */
.log-content {
  max-width: 300px;
}

.log-action {
  font-weight: 600;
  color: #4e73df;
}

.log-details {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.25rem;
  white-space: pre-line;
  max-height: 100px;
  overflow-y: auto;
  border-top: 1px dashed #e3e6f0;
  padding-top: 0.25rem;
}

/* 边框颜色 */
.border-left-primary {
  border-left: 0.25rem solid var(--primary-color) !important;
}

.border-left-success {
  border-left: 0.25rem solid var(--success-color) !important;
}

.border-left-info {
  border-left: 0.25rem solid var(--info-color) !important;
}

.border-left-warning {
  border-left: 0.25rem solid var(--warning-color) !important;
}

.border-left-danger {
  border-left: 0.25rem solid var(--danger-color) !important;
}

/* 文本颜色 */
.text-primary {
  color: var(--primary-color) !important;
}

.text-success {
  color: var(--success-color) !important;
}

.text-info {
  color: var(--info-color) !important;
}

.text-warning {
  color: var(--warning-color) !important;
}

.text-danger {
  color: var(--danger-color) !important;
}

.text-gray-300 {
  color: #dddfeb !important;
}

.text-gray-500 {
  color: #b7b9cc !important;
}

.text-gray-800 {
  color: #5a5c69 !important;
}

/* 强制修复布局问题 */
@media (min-width: 769px) {
  .content-wrapper {
    width: calc(100% - 250px) !important;
    margin-left: 250px !important;
    position: relative !important;
  }

  .sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    transform: translateX(0) !important;
    z-index: 1000 !important;
  }

  /* 确保主内容不被遮盖 */
  .main-content {
    position: relative !important;
    z-index: 1 !important;
  }

  /* 调试：给内容区域添加背景色 */
  .content-wrapper {
    background-color: #f8f9fc !important;
    min-height: 100vh !important;
  }
}
