/* Air780EHV 网关管理面板样式 */

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #475569;
  --radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.status-badge.connected {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.status-badge.disconnected {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.signal-info {
  font-size: 12px;
  color: var(--text-muted);
}

.ws-status {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
}

.ws-status.connected {
  color: var(--success);
}

.ws-status.disconnected {
  color: var(--danger);
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
}

.tab {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

.tab:hover {
  color: var(--text);
}

/* Tab Content */
.tab-content {
  display: none;
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Call Status */
.call-status {
  text-align: center;
  padding: 30px 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.call-status.active {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.05);
}

.call-status.ringing {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.05);
  animation: pulse 1.5s infinite;
}

.call-status.dialing {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.call-status-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.call-status-text {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.call-number {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 1px;
}

.call-timer {
  font-size: 20px;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}

/* Incoming Call */
.incoming-call {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.15),
    rgba(239, 68, 68, 0.15)
  );
  border: 2px solid var(--warning);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  animation: pulse 1s infinite;
}

.incoming-call-icon {
  font-size: 60px;
  margin-bottom: 10px;
}

.incoming-call-number {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 5px;
}

.incoming-call-text {
  color: var(--warning);
  margin-bottom: 20px;
}

.incoming-call-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* Dialer */
.dialer {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}

.phone-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 22px;
  text-align: center;
  letter-spacing: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  margin-bottom: 16px;
}

.phone-input:focus {
  border-color: var(--primary);
}

.dial-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.dial-key {
  padding: 16px;
  font-size: 22px;
  font-weight: 500;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  margin: 0 auto;
  transition: all 0.15s;
  line-height: 1;
}

.dial-key small {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 2px;
}

.dial-key:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.dial-key:active {
  transform: scale(0.95);
}

.dial-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  filter: brightness(1.1);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-success {
  background: var(--success);
  color: white;
}
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-warning {
  background: var(--warning);
  color: #1a1a1a;
}
.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
}

.btn-call {
  background: var(--success);
  color: white;
  flex: 1;
  justify-content: center;
  font-size: 18px;
  padding: 14px;
  border-radius: 30px;
}

.btn-hangup {
  background: var(--danger);
  color: white;
  flex: 1;
  justify-content: center;
  font-size: 18px;
  padding: 14px;
  border-radius: 30px;
}

.btn-backspace {
  background: var(--bg-input);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 30px;
  font-size: 18px;
}

/* Audio Controls */
.audio-controls {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

.audio-status {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.audio-actions {
  display: flex;
  gap: 10px;
}

/* SMS */
.sms-compose,
.sms-inbox {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}

.sms-compose h3,
.sms-inbox h3 {
  margin-bottom: 16px;
  font-size: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.input:focus {
  border-color: var(--primary);
}

.textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.char-count {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.sms-messages {
  max-height: 400px;
  overflow-y: auto;
}

.sms-item {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.sms-item:last-child {
  border-bottom: none;
}

.sms-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sms-item-number {
  font-weight: 600;
  font-size: 14px;
}

.sms-item-time {
  font-size: 12px;
  color: var(--text-muted);
}

.sms-item-content {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.sms-item.incoming .sms-item-number::before {
  content: "📥 ";
}

.sms-item.outgoing .sms-item-number::before {
  content: "📤 ";
}

/* Logs */
.logs-tabs {
  display: flex;
  gap: 10px;
}

.logs-tab {
  padding: 8px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.logs-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.logtab-content {
  display: none;
}

.logtab-content.active {
  display: block;
}

.log-list {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  max-height: 500px;
  overflow-y: auto;
}

.log-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.log-item:last-child {
  border-bottom: none;
}

.log-item-icon {
  font-size: 24px;
}

.log-item-info {
  flex: 1;
}

.log-item-number {
  font-weight: 600;
  font-size: 14px;
}

.log-item-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.log-item-time {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

.log-actions {
  margin-top: 10px;
  text-align: center;
}

/* Settings */
.settings-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}

.settings-section h3 {
  margin-bottom: 16px;
  font-size: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-item {
  padding: 8px;
  background: var(--bg-input);
  border-radius: 8px;
}

.info-item label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.info-item span {
  font-size: 13px;
  font-weight: 500;
  word-break: break-all;
}

.settings-section button {
  margin-right: 10px;
  margin-top: 8px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  animation: slideIn 0.3s ease;
  max-width: 320px;
  word-break: break-word;
}

.toast.success {
  background: var(--success);
}
.toast.error {
  background: var(--danger);
}
.toast.info {
  background: var(--primary);
}
.toast.warning {
  background: var(--warning);
  color: #1a1a1a;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 480px) {
  #app {
    max-width: 100%;
  }
  .header {
    padding: 12px 16px;
  }
  .tab-content {
    padding: 16px;
  }
}
