/* ============================================
   Tesla Quotation System - 特斯拉报价系统
   暗色主题 · 极简设计 · 响应式适配
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-card: #111111;
  --bg-card-hover: #181818;
  --bg-elevated: #1a1a1a;
  --bg-input: #141414;
  --text-primary: #f5f5f5;
  --text-secondary: #a0a0a0;
  --text-muted: #5c5c5c;
  --brand-red: #e31937;
  --brand-red-hover: #ff2040;
  --brand-red-glow: rgba(227, 25, 55, 0.25);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-active: rgba(227, 25, 55, 0.5);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 60px rgba(227, 25, 55, 0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --max-width: 1200px;
  --header-height: 64px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(227, 25, 55, 0.04), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(227, 25, 55, 0.02), transparent);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--text-primary);
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
}

/* --- Header / Navigation --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-logo .logo-icon {
  width: 34px;
  height: 34px;
  background: var(--brand-red);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 0 20px var(--brand-red-glow);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.header-nav a:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.header-nav a.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.header-nav a.admin-link {
  background: rgba(227, 25, 55, 0.1);
  color: var(--brand-red);
}

.header-nav a.admin-link:hover {
  background: rgba(227, 25, 55, 0.2);
}

/* --- Layout --- */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 60px 0;
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 80px 0 50px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(227, 25, 55, 0.08);
  border: 1px solid rgba(227, 25, 55, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--brand-red);
  margin-bottom: 24px;
  letter-spacing: 0.04em;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero-title .highlight {
  background: linear-gradient(135deg, var(--brand-red), #ff6b7a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all var(--transition-base);
}

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

.card-glow {
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

/* --- Quotation Panel --- */
.quotation-panel {
  max-width: 780px;
  margin: 0 auto;
}

.quotation-panel .card {
  padding: 40px;
}

.selector-group {
  margin-bottom: 28px;
}

.selector-group:last-of-type {
  margin-bottom: 36px;
}

.selector-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.mileage-input {
  width: 100%;
  max-width: 240px;
}

.chip {
  position: relative;
  padding: 10px 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
}

.chip:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.chip.selected {
  color: #fff;
  background: var(--brand-red);
  border-color: var(--brand-red);
  box-shadow: 0 0 20px var(--brand-red-glow);
  transform: translateY(-1px);
}

.chip.selected:hover {
  background: var(--brand-red-hover);
  border-color: var(--brand-red-hover);
}

.chip-disabled {
  opacity: 0.3;
  pointer-events: none;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* --- Price Display --- */
.price-display {
  text-align: center;
  padding: 32px 0 8px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
}

.price-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.price-value {
  font-family: var(--font-mono);
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  transition: all var(--transition-slow);
}

.price-value.has-price {
  background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 50%, #ffffff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.price-value.no-price {
  color: var(--text-muted);
  font-size: 1.5rem;
  font-weight: 400;
}

.price-unit {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-left: 4px;
  font-family: var(--font-sans);
}

.price-note {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.price-animate {
  animation: priceReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes priceReveal {
  0% {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* --- Feature Highlights --- */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 48px;
}

.feature-item {
  text-align: center;
  padding: 24px 16px;
}

.feature-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(227, 25, 55, 0.08);
  border: 1px solid rgba(227, 25, 55, 0.12);
}

.feature-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 32px 0;
  text-align: center;
}

.footer-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ============================================
   Admin Page Styles
   ============================================ */

/* --- Form --- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  align-items: end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.form-select,
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select:hover,
.form-input:hover {
  border-color: var(--border-hover);
}

.form-select:focus,
.form-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(227, 25, 55, 0.1);
}

.form-select option:disabled {
  color: #444;
}

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-red);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-red-hover);
  box-shadow: 0 4px 20px var(--brand-red-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  color: #ff4444;
}

.btn-danger:hover {
  background: rgba(255, 68, 68, 0.1);
  color: #ff6666;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
}

/* --- Table --- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table thead {
  border-bottom: 1px solid var(--border-default);
}

.data-table th {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

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

.price-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--brand-red);
}

.condition-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
}

.condition-premium {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.condition-defect {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

/* --- Toast / Notification --- */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  font-size: 0.85rem;
  color: var(--text-primary);
  animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success {
  border-left: 3px solid #34d399;
}

.toast.error {
  border-left: 3px solid #ff4444;
}

.toast.removing {
  animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state-text {
  font-size: 0.95rem;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-elevated);
  animation: scaleIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* --- Utility --- */
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  transition: all var(--transition-base);
}

.stat-card:hover {
  border-color: var(--border-hover);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-value.red {
  color: var(--brand-red);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .features {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .hero {
    padding: 50px 0 30px;
  }

  .hero-title {
    font-size: 1.9rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .quotation-panel .card {
    padding: 24px 20px;
  }

  .selector-group {
    margin-bottom: 20px;
  }

  .chip {
    padding: 8px 16px;
    font-size: 0.82rem;
  }

  .price-value {
    font-size: 2.4rem;
  }

  .price-value.no-price {
    font-size: 1.2rem;
  }

  .features {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .feature-item {
    padding: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 40px 0;
  }

  .container {
    padding: 0 16px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .modal {
    padding: 24px 20px;
  }

  .header-inner {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.6rem;
  }

  .chip-row {
    gap: 6px;
  }

  .chip {
    padding: 7px 13px;
    font-size: 0.78rem;
  }

  .price-display {
    padding: 24px 0 4px;
  }
}
