/* 智能称重系统 - 通用样式 */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700&display=swap');

@font-face {
  font-family: Orbitron;
  font-style: normal;
  font-weight: 700;
  src: url(/cf-fonts/v/orbitron/5.0.18/latin/wght/normal.woff2);
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
  font-display: swap;
}

:root {
  --led-on: #0f4;
  --led-off: #004f10;
  --glass: #0a0a0a;
  --panel-bg: #111;
  --text-color: #eee;
  --text-secondary: #aaa;
  --button-bg: #222;
  --button-hover: #333;
  --border-color: #222;
  --orange-border: rgba(255, 165, 0, 0.3);
  --orange-primary: #ffa500;
  --success: #0f4;
  --error: #f30;
  --warning: #fc0;
  --shadow: 0 0 20px rgba(0, 255, 65, 0.65);
  --shadow-orange: 0 0 15px rgba(255, 165, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: linear-gradient(to bottom, #0a1929, #0d1e2d) no-repeat center / 100vw 100vh;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  min-width: 360px;
  overflow: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 面板样式 */
.panel {
  background: radial-gradient(circle at center, var(--glass) 60%, #000);
  border: 2px solid var(--orange-border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  flex-shrink: 0;
  margin-bottom: 10px;
}

/* 按钮样式 */
.btn {
  background: var(--button-bg);
  color: var(--text-secondary);
  border: 1px solid rgba(0, 255, 65, 0.65);
  border-radius: 6px;
  padding: 12px 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  min-height: 44px;
}

.btn:hover {
  border-color: var(--success);
  background: var(--button-hover);
  color: var(--text-color);
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  border-color: rgba(0, 255, 65, 0.3);
}

.btn-primary {
  background: var(--orange-primary);
  color: #000;
  border-color: var(--orange-primary);
}

.btn-primary:hover {
  background: #ffb733;
  box-shadow: var(--shadow-orange);
}

.btn-danger {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

.btn-danger:hover {
  background: #ff4444;
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
}

/* 输入框样式 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  background: var(--button-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px 16px;
  color: var(--text-color);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--success);
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.form-input::placeholder {
  color: #666;
}

/* 卡片样式 */
.card {
  background: radial-gradient(circle at center, var(--glass) 60%, #000);
  border: 1px solid var(--orange-border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-orange);
  transition: all 0.3s ease;
}

.card:hover {
  border-color: var(--orange-primary);
  box-shadow: var(--shadow-orange);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.1rem;
  color: var(--orange-primary);
  font-weight: 500;
}

.card-content {
  color: var(--text-color);
}

/* 状态指示器 */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-dot.offline {
  background: var(--error);
  box-shadow: 0 0 6px var(--error);
}

.status-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
}

/* 网格布局 */
.grid {
  display: grid;
  gap: 15px;
  flex: 1;
  overflow-y: auto;
  padding-bottom: 80px; /* 为底部导航留空间 */
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: radial-gradient(circle at center, var(--glass) 60%, #000);
  border-top: 1px solid var(--orange-border);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 1000;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all 0.3s ease;
  padding: 8px 4px;
}

.nav-item:hover {
  background: rgba(255, 165, 0, 0.1);
  color: var(--orange-primary);
}

.nav-item.active {
  color: var(--success);
  text-shadow: 0 0 5px var(--success);
}

.nav-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.nav-text {
  font-size: 0.75rem;
  white-space: nowrap;
}

/* 加载状态 */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  color: var(--text-secondary);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--success);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1rem;
  margin-bottom: 20px;
}

/* 响应式设计 */
@media (max-width: 767px) {
  .container {
    padding: 10px;
  }
  
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .card {
    padding: 12px;
  }
  
  .btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .nav-item {
    max-width: 120px;
  }
}

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-orange { color: var(--orange-primary); }

.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }

.hidden { display: none; }
.visible { display: block; }

/* 模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
}

.modal {
  background: radial-gradient(circle at center, var(--glass) 60%, #000);
  border: 2px solid var(--orange-border);
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.2rem;
  color: var(--orange-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: var(--button-hover);
  color: var(--text-color);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}
