:root {
  --primary-color: #3498db;
  --secondary-color: #2980b9;
  --accent-color: #1abc9c;
  --text-color: #333;
  --text-light: #fff;
  --bg-color: #f8f9fa;
  --sidebar-bg: #2c3e50;
  --sidebar-hover: #34495e;
  --header-height: 60px;
  --transition-speed: 0.3s;

  --dark-bg-color: #1a1a1a;
  --dark-text-color: #f0f0f0;
  --dark-sidebar-bg: #121212;
  --dark-sidebar-hover: #1e1e1e;
  --dark-header-bg: #2d2d2d;
  --dark-card-bg: #252525;
  --dark-button-bg: #3b424b;
  --dark-border-color: #444;

  /*毛玻璃效果变量*/
  --blur-intensity: 10px;
  --glass-opacity: 0.75;
  --glass-opacity-light: 0.7;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
}

body.dark-mode {
  background-color: var(--dark-bg-color);
  color: var(--dark-text-color);
}

body.dark-mode .topbar {
  background: rgba(45, 45, 45, var(--glass-opacity));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(68, 68, 68, 0.3);
}

body.dark-mode .user-info:hover {
  background: var(--dark-sidebar-hover);
}

body.dark-mode .toggle-sidebar:hover {
  background: var(--dark-sidebar-hover);
}

body.dark-mode .sidebar {
  background: rgba(18, 18, 18, var(--glass-opacity));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
}

body.dark-mode .menu-link:hover,
body.dark-mode .menu-link.active {
  background: rgba(30, 30, 30, 0.7);
}

body.dark-mode .submenu {
  background: rgba(0, 0, 0, 0.3);
}

body.dark-mode .submenu-link:hover,
body.dark-mode .submenu-link.active {
  color: var(--accent-color);
}

body.dark-mode .card,
body.dark-mode .panel {
  background: rgba(37, 37, 37, var(--glass-opacity-light));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  border: 1px solid rgba(68, 68, 68, 0.3);
}

body.dark-mode table {
  background: rgba(37, 37, 37, var(--glass-opacity-light));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  color: var(--dark-text-color);
  border: 1px solid rgba(68, 68, 68, 0.3);
}

body.dark-mode table tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode table th {
  background-color: rgba(18, 18, 18, 0.8);
  border-color: rgba(68, 68, 68, 0.3);
}

body.dark-mode table td {
  border-color: rgba(68, 68, 68, 0.3);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background-color: rgba(37, 37, 37, var(--glass-opacity-light));
  color: var(--dark-text-color);
  border-color: rgba(68, 68, 68, 0.3);
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 0.2rem rgba(26, 188, 156, 0.25);
}

body.dark-mode button:not(.toggle-sidebar):not(.logout-btn) {
  background-color: rgba(37, 37, 37, var(--glass-opacity-light));
  color: var(--bg-color);
  border-color: rgba(68, 68, 68, 0.3);
}

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

body.dark-mode .btn-danger {
  background-color: #e74c3c;
  border-color: #e74c3c;
}

body.dark-mode .btn-success {
  background-color: #27ae60;
  border-color: #27ae60;
}

body.dark-mode .alert {
  background-color: rgba(37, 37, 37, var(--glass-opacity-light));
  border-color: rgba(68, 68, 68, 0.3);
  color: var(--dark-text-color);
}

.dashboard-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background: rgba(44, 62, 80, var(--glass-opacity));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  color: var(--text-light);
  transition: width var(--transition-speed), background var(--transition-speed),
    backdrop-filter var(--transition-speed);
  overflow-y: auto;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar-header {
  padding: 20px 15px;
  display: flex;
  align-items: center;
  height: var(--header-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  width: 35px;
  height: 35px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}

.sidebar-title {
  font-weight: 600;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-title {
  display: none;
}

.sidebar-menu {
  padding: 15px 0;
}

.menu-item {
  position: relative;
}

.menu-link {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: var(--text-light);
  text-decoration: none;
  transition: all 0.3s;
  border-left: 3px solid transparent;
}

.menu-link:hover,
.menu-link.active {
  background: rgba(52, 73, 94, 0.7);
  border-left-color: var(--accent-color);
}

.menu-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}

.menu-text {
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .menu-text {
  display: none;
}

.sidebar.collapsed .menu-arrow {
  display: none;
}

.menu-arrow {
  margin-left: auto;
  transition: transform 0.3s;
}

.menu-item.open .menu-arrow {
  transform: rotate(90deg);
}

.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.2);
}

.menu-item.open .submenu {
  max-height: 500px;
}

.submenu-item {
  padding: 10px 15px 10px 45px;
}

.submenu-link {
  color: var(--text-light);
  text-decoration: none;
  display: block;
  opacity: 0.8;
  transition: opacity 0.3s;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.submenu-link:hover,
.submenu-link.active {
  opacity: 1;
  color: var(--accent-color);
}

.sidebar.collapsed .submenu {
  display: none;
}

.main-content {
  flex: 1;
  margin-left: 250px;
  transition: margin-left var(--transition-speed);
}

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

.topbar {
  height: var(--header-height);
  background: rgba(255, 255, 255, var(--glass-opacity));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 999;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.topbar-left {
  display: flex;
  align-items: center;
}

.toggle-sidebar {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 20px;
  cursor: pointer;
  margin-right: 15px;
  padding: 5px;
  border-radius: 4px;
  transition: background 0.3s;
}

.toggle-sidebar:hover {
  background: rgba(240, 240, 240, 0.5);
}

.topbar-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
}

.topbar-right {
  display: flex;
  align-items: center;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: background 0.3s;
  margin-right: 10px;
  font-size: 18px;
  width: 30px;
  height: 30px;
}

.theme-toggle:hover {
  background: rgba(240, 240, 240, 0.5);
}

body.dark-mode .theme-toggle:hover {
  background: rgba(30, 30, 30, 0.5);
}

.user-info {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 20px;
  transition: background 0.3s;
}

.user-info:hover {
  background: rgba(240, 240, 240, 0.5);
}

body.dark-mode .user-info:hover {
  background: rgba(30, 30, 30, 0.5);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  margin-right: 10px;
}

.user-name {
  margin-right: 10px;
  font-size: 14px;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: background 0.3s;
}

body.dark-mode .logout-btn {
  color: var(--bg-color);
}

.logout-btn:hover {
  background: rgba(240, 240, 240, 0.5);
}

body.dark-mode .logout-btn:hover {
  background: rgba(30, 30, 30, 0.5);
}

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
  z-index: 9999;
  transition: width 0.3s ease;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.loading-bar.hidden {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.content {
  padding: 20px;
}

.card {
  background: rgba(255, 255, 255, var(--glass-opacity-light));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
  transition: box-shadow 0.3s, background 0.3s, backdrop-filter 0.3s;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 10px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, var(--glass-opacity-light));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

table th,
table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

table th {
  background-color: rgba(248, 249, 250, 0.8);
  font-weight: 600;
  color: #555;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:nth-child(even) {
  background-color: rgba(248, 249, 250, 0.5);
}

button {
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

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

.btn-primary:hover {
  background-color: #2980b9;
  border-color: #2980b9;
}

.btn-danger {
  background-color: #e74c3c;
  color: white;
  border-color: #e74c3c;
}

.btn-danger:hover {
  background-color: #c0392b;
  border-color: #c0392b;
}

.btn-success {
  background-color: #27ae60;
  color: white;
  border-color: #27ae60;
}

.btn-success:hover {
  background-color: #219653;
  border-color: #219653;
}

input,
select,
textarea {
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
  background: rgba(255, 255, 255, 0.9);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 0.2rem rgba(26, 188, 156, 0.25);
}

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

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

.alert {
  padding: 12px 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
}

.alert-success {
  background-color: rgba(212, 237, 218, var(--glass-opacity-light));
  border: 1px solid rgba(195, 230, 203, 0.5);
  color: #155724;
}

.alert-danger {
  background-color: rgba(248, 215, 218, var(--glass-opacity-light));
  border: 1px solid rgba(245, 198, 203, 0.5);
  color: #721c24;
}

.alert-warning {
  background-color: rgba(255, 243, 205, var(--glass-opacity-light));
  border: 1px solid rgba(255, 234, 167, 0.5);
  color: #856404;
}

@media (max-width: 768px) {
  :root {
    --glass-opacity: 0.2;
  }

  .sidebar {
    width: 0;
    overflow-x: hidden;
    transition: width var(--transition-speed) ease;
  }

  .sidebar.mobile-open {
    width: 250px;
  }

  .sidebar-title,
  .menu-text,
  .submenu {
    display: block;
  }

  .sidebar.collapsed .sidebar-title,
  .sidebar.collapsed .menu-text,
  .sidebar.collapsed .submenu {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed), visibility 0s;
  }

  .sidebar-overlay.open {
    display: block;
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-speed), visibility 0s;
  }
}
.gauge-container {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-title {
  font-size: 16px;
  margin-bottom: 10px;
  color: #777;
}

body.dark-mode .gauge-title {
  color: #aaa;
}

.gauge-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
  margin-top: 10px;
}

body.dark-mode .gauge-value {
  color: var(--accent-color);
}

/* Permissions page specific styles */
.permissions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

.permission-card {
  flex: 1;
  min-width: 300px;
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .permissions-container {
    flex-direction: column;
  }

  .permission-card {
    min-width: 100%;
  }
}

@media (min-width: 769px) {
  .sidebar-overlay {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 10px;
  }

  .user-name {
    display: none;
  }
}
body.dark-mode .info-label {
  color: #aaa;
}

.info-value {
  font-weight: 600;
}

body.dark-mode .info-value {
  color: var(--dark-text-color);
}

.status-online {
  color: #2ecc71;
}

.status-offline {
  color: #e74c3c;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 10px;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.info-card {
  background: rgba(255, 255, 255, var(--glass-opacity-light));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 20px;
  margin-bottom: 20px;
  margin-top: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .info-card {
  background: rgba(37, 37, 37, var(--glass-opacity-light));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(68, 68, 68, 0.3);
}

body.dark-mode .card-header {
  border-bottom: 1px solid rgba(68, 68, 68, 0.3);
}

body.dark-mode .card-title {
  color: var(--accent-color);
}

.refresh-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background 0.3s;
}

body.dark-mode .refresh-btn {
  background: var(--accent-color);
}

.refresh-btn:hover {
  background: var(--accent-color);
}

body.dark-mode .refresh-btn:hover {
  background: #3498db;
}

.refresh-btn i {
  margin-right: 5px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

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

body.dark-mode .info-item {
  border-bottom: 1px solid rgba(68, 68, 68, 0.3);
}

.info-label {
  color: #777;
  font-weight: 500;
}

.glass-card {
  background: rgba(255, 255, 255, var(--glass-opacity-light));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: background 0.3s, backdrop-filter 0.3s;
}

body.dark-mode .glass-card {
  background: rgba(37, 37, 37, var(--glass-opacity-light));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(68, 68, 68, 0.3);
}

.glass-container {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

body.dark-mode .glass-container {
  background: rgba(37, 37, 37, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-button {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-color);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

.glass-button:hover {
  background: rgba(255, 255, 255, 0.25);
}

body.dark-mode .glass-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--dark-text-color);
}

body.dark-mode .glass-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 毛玻璃效果的模态框 */
.glass-modal {
  background: rgba(255, 255, 255, var(--glass-opacity));
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

body.dark-mode .glass-modal {
  background: rgba(37, 37, 37, var(--glass-opacity));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}