/* 小智控制台样式 - 简洁实用，不花哨 */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: #f7f8fa;
  color: #1a1a1a;
  font-size: 14px;
  line-height: 1.6;
}

/* ============ Top Bar ============ */
.topbar {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  color: white;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.api-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
}
.api-status.ok { background: #22c55e; }
.api-status.error { background: #ef4444; }

/* ============ Tabs ============ */
.tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 32px;
  gap: 0;
}
.tab {
  background: none;
  border: none;
  padding: 14px 24px;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab:hover { color: #1a1a1a; }
.tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  font-weight: 500;
}

/* ============ Main ============ */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 32px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============ Forms ============ */
.form-row { margin-bottom: 20px; }
.form-row > label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: #374151;
}
.form-row input[type=text],
.form-row input[type=number],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  transition: border-color 0.15s;
}
.form-row textarea { resize: vertical; min-height: 100px; }
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-row.split {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.form-row.split > div > label { font-size: 13px; }

.hint {
  margin-top: 4px;
  font-size: 12px;
  color: #9ca3af;
}

.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }

/* ============ Device Picker ============ */
.device-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.device-picker label { font-weight: 500; color: #374151; }
.device-picker select {
  flex: 1;
  max-width: 300px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  background: white;
}

/* ============ Buttons ============ */
.btn {
  background: white;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  color: #374151;
  transition: all 0.15s;
  font-family: inherit;
}
.btn:hover { background: #f9fafb; border-color: #9ca3af; }
.btn.primary {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}
.btn.primary:hover { background: #2563eb; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { color: #ef4444; border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}
.actions.top-actions { margin-top: 0; margin-bottom: 16px; }
.save-status { font-size: 13px; color: #6b7280; }
.save-status.ok { color: #22c55e; }
.save-status.error { color: #ef4444; }

/* ============ Tables ============ */
.memory-list-wrap,
.device-table {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 16px;
}
.memory-table, .device-table {
  width: 100%;
  border-collapse: collapse;
}
.memory-table th, .memory-table td,
.device-table th, .device-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
}
.memory-table th, .device-table th {
  background: #f9fafb;
  font-weight: 500;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
}
.memory-table tr:last-child td,
.device-table tr:last-child td { border-bottom: none; }
.memory-table tr:hover,
.device-table tr:hover { background: #f9fafb; }
.empty { text-align: center; color: #9ca3af; padding: 32px !important; }

.online { color: #22c55e; font-weight: 500; }
.offline { color: #9ca3af; }
.activated { color: #22c55e; }
.not-activated { color: #f59e0b; }

/* ============ Footer ============ */
footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: #9ca3af;
}
footer a { color: #6b7280; text-decoration: none; }
footer a:hover { color: #3b82f6; }

/* ============ Responsive ============ */
@media (max-width: 640px) {
  .form-row.split { grid-template-columns: 1fr; }
  main, .topbar, .tabs { padding-left: 16px; padding-right: 16px; }
}

/* ============ TTS Advanced Block ============ */
.tts-config-block {
  margin-top: 20px;
  padding: 12px 16px;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.tts-config-block summary {
  cursor: pointer;
  font-weight: 500;
  color: #374151;
  user-select: none;
  padding: 4px 0;
}
.tts-config-block[open] summary { margin-bottom: 12px; color: #3b82f6; }
