/* ETH期权卖方监控系统 - 样式表 */

/* ============ 基础变量 ============ */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --surface: rgba(30, 41, 59, 0.7);
  --surface-hover: rgba(51, 65, 85, 0.8);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #00d4ff;
  --accent-secondary: #7c3aed;
  --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --put-color: #ef4444;
  --put-bg: rgba(239, 68, 68, 0.1);
  --call-color: #10b981;
  --call-bg: rgba(16, 185, 129, 0.1);

  --border-color: rgba(148, 163, 184, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

/* ============ 重置与基础 ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============ 背景动效 ============ */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(124, 58, 237, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: -2;
}

.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: -1;
}

/* ============ 容器 ============ */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============ 头部 ============ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 32px;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.logo-text h1 {
  font-size: 20px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text .subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  transition: var(--transition-normal);
}

.status-card.connected {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1.5s infinite;
}

.status-card.connected .status-dot {
  background: var(--success);
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.status-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.price-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: var(--radius-md);
  transition: var(--transition-normal);
}

.price-card.loaded {
  animation: glow 2s ease infinite;
}

@keyframes glow {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
  }

  50% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
  }
}

.price-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.price-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-primary);
}

.price-change {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-normal);
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--accent-primary);
}

.btn-large {
  padding: 14px 32px;
  font-size: 16px;
}

.btn-icon {
  font-size: 16px;
}

.btn-delete {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition-fast);
}

.btn-delete:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* ============ 主体 ============ */
.main {
  display: flex;
  gap: 20px;
  flex: 1;
}

/* ============ 侧边栏 ============ */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-normal);
  font-family: inherit;
  text-align: left;
}

.nav-tab:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.nav-tab.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm);
}

.tab-icon {
  font-size: 18px;
}

/* ============ 信息卡片 ============ */
.info-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-card {
  padding: 16px;
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.info-icon {
  font-size: 20px;
}

.info-icon.sell-put {
  color: var(--put-color);
}

.info-icon.covered-call {
  color: var(--call-color);
}

.info-title {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.info-status {
  font-size: 13px;
  color: var(--text-muted);
}

.info-status.triggered {
  color: var(--success);
  font-weight: 500;
}

/* ============ Glass Card ============ */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: var(--transition-normal);
}

.glass-card:hover {
  border-color: rgba(0, 212, 255, 0.2);
}

/* ============ 内容区 ============ */
.content {
  flex: 1;
  min-width: 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ Section Card ============ */
.section-card {
  padding: 24px;
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.section-actions {
  display: flex;
  gap: 12px;
}

/* ============ 表格 ============ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.data-table tr:hover td {
  background: rgba(0, 212, 255, 0.05);
}

.option-row.put {
  border-left: 3px solid var(--put-color);
}

.option-row.call {
  border-left: 3px solid var(--call-color);
}

.type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.type-badge.put {
  background: var(--put-bg);
  color: var(--put-color);
}

.type-badge.call {
  background: var(--call-bg);
  color: var(--call-color);
}

.data-table .warning {
  color: var(--warning);
  font-weight: 500;
}

.data-table .yield {
  color: var(--success);
  font-weight: 600;
}

.data-table .instrument {
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ============ 图表 ============ */
.chart-container {
  height: 200px;
  position: relative;
}

.chart-container canvas {
  width: 100%;
  height: 100%;
}

/* ============ 配置表单 ============ */
.config-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.config-grid .full-width {
  grid-column: 1 / -1;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-styled {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition-normal);
}

.input-styled:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.input-styled::placeholder {
  color: var(--text-muted);
}

.input-with-unit {
  position: relative;
}

.input-with-unit .unit {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.input-with-unit .input-styled {
  padding-left: 32px;
}

.select-styled {
  padding: 8px 32px 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  transition: var(--transition-normal);
}

.select-styled:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* ============ Switch ============ */
.switch-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.switch-input {
  display: none;
}

.switch-slider {
  width: 44px;
  height: 24px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  position: relative;
  transition: var(--transition-normal);
}

.switch-slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: var(--transition-normal);
}

.switch-input:checked+.switch-slider {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.switch-input:checked+.switch-slider::after {
  transform: translateX(20px);
  background: white;
}

.switch-text {
  font-size: 14px;
  color: var(--text-primary);
}

.form-actions {
  margin-top: 20px;
  text-align: center;
}

/* ============ 风险配置网格 ============ */
.risk-config-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.risk-config-item h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

/* ============ 持仓表单 ============ */
.add-position-form {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.form-row .form-group.flex-1 {
  flex: 2;
}

.form-row+.form-row {
  margin-top: 16px;
}

/* ============ 持仓列表 ============ */
.positions-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.position-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 16px;
  border-left: 4px solid;
  transition: var(--transition-normal);
}

.position-card.put {
  border-color: var(--put-color);
}

.position-card.call {
  border-color: var(--call-color);
}

.position-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.position-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.position-type {
  font-size: 14px;
  font-weight: 600;
}

.position-card.put .position-type {
  color: var(--put-color);
}

.position-card.call .position-type {
  color: var(--call-color);
}

.position-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.position-detail {
  display: flex;
  flex-direction: column;
}

.position-detail .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.position-detail .value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.position-note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ============ 告警列表 ============ */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid;
}

.alert-card.info {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--info);
}

.alert-card.warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--warning);
}

.alert-card.critical {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}

.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.alert-title {
  font-size: 14px;
  font-weight: 600;
}

.alert-time {
  font-size: 12px;
  color: var(--text-muted);
}

.alert-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.alert-suggestion {
  font-size: 13px;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: var(--radius-sm);
}

/* ============ 底部 ============ */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  margin-top: 20px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.divider {
  color: var(--border-color);
}

.footer-right {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============ Toast通知 ============ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: var(--transition-normal);
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-info {
  border-left: 4px solid var(--info);
}

.toast-icon {
  font-size: 18px;
}

.toast-message {
  font-size: 14px;
  color: var(--text-primary);
}

/* ============ 响应式 ============ */
@media (max-width: 1200px) {
  .config-grid {
    grid-template-columns: 1fr;
  }

  .risk-config-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .main {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .nav-tabs {
    flex-direction: row;
    overflow-x: auto;
  }

  .info-cards {
    flex-direction: row;
    overflow-x: auto;
  }

  .info-card {
    min-width: 200px;
  }

  .header {
    flex-direction: column;
    gap: 16px;
  }

  .header-right {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 12px;
  }

  .form-row {
    flex-direction: column;
  }

  .positions-list {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px;
  }

  .section-actions {
    flex-wrap: wrap;
  }

  .strike-filter {
    width: 100%;
  }
}

/* ============ 登录界面 ============ */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  text-align: center;
}

.login-header {
  margin-bottom: 32px;
}

.login-logo {
  font-size: 64px;
  margin-bottom: 16px;
  animation: pulse 2s infinite;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.login-card .form-group {
  margin-bottom: 24px;
}

.login-card .input-styled {
  text-align: center;
  font-size: 16px;
  padding: 14px 20px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.login-error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 16px;
  min-height: 20px;
}

/* ============ 行权价筛选器 ============ */
.strike-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-sep {
  color: var(--text-muted);
}

.input-small {
  width: 100px;
  padding: 8px 12px;
  font-size: 13px;
}

.btn-small {
  padding: 8px 12px;
  font-size: 13px;
}

/* ============ 钉钉测试结果 ============ */
.test-result {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  min-height: 44px;
}

.test-result.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.test-result.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.test-result .loading {
  color: var(--text-muted);
}

/* ============ 年化收益高亮 ============ */
.data-table .yield.high-yield {
  color: #22c55e;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.data-table .yield.mid-yield {
  color: #84cc16;
  font-weight: 600;
}

/* ============ 搜索框 ============ */
.search-filter {
  display: flex;
  align-items: center;
}

.search-filter .input-small {
  width: 140px;
}