/* ============================================
   组件样式 — Navigation / Buttons / Cards / Forms
   ============================================ */

/* ---------- Navigation ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  height: var(--nav-height);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

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

.navbar.scrolled {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: var(--tracking-wide);
  transition: color var(--duration-fast) var(--ease-out-expo);
}

.nav-logo span {
  color: var(--color-primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  transition: color var(--duration-fast) var(--ease-out-expo);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-out-expo);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Theme Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-normal) var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-glow);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform var(--duration-normal) var(--ease-spring),
              opacity var(--duration-normal) var(--ease-out-expo);
  position: absolute;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  stroke: var(--text-secondary);
}

[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

.theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  z-index: var(--z-overlay);
}

.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    flex-direction: column;
    background: var(--bg-primary);
    padding: calc(var(--nav-height) + var(--space-8)) var(--space-8) var(--space-8);
    gap: var(--space-6);
    transition: right var(--duration-normal) var(--ease-out-expo);
    box-shadow: var(--shadow-xl);
  }

  .nav-links.open {
    right: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .nav-links a {
    font-size: var(--text-base);
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 2rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-expo);
  border: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  transition: background var(--duration-normal) var(--ease-out-expo);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(196, 139, 125, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(196, 139, 125, 0.4);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border-medium);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: var(--text-base);
}

.btn-sm {
  padding: 0.5rem 1.25rem;
  font-size: var(--text-xs);
}

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-full);
}

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

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary-light);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.card-glass:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
}

.card-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.card-image img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  transition: transform var(--duration-slower) var(--ease-out-expo);
}

.card:hover .card-image img {
  transform: scale(1.05);
}

.card-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  background: rgba(196, 139, 125, 0.1);
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out-expo);
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(196, 139, 125, 0.15);
  background: var(--bg-card);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-input.error,
.form-textarea.error {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-error {
  font-size: var(--text-xs);
  color: #e74c3c;
  margin-top: var(--space-1);
}

.form-success {
  font-size: var(--text-sm);
  color: #27ae60;
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  top: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 9999;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  max-width: min(90vw, 420px);
  box-shadow: var(--shadow-lg);
  background: var(--color-primary);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  text-align: center;
  line-height: 1.5;
  word-break: break-word;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.toast-success {
  background: #27ae60;
  color: #fff;
}

.toast-error {
  background: #e74c3c;
  color: #fff;
}

.toast-info {
  background: var(--color-primary);
  color: #fff;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(20px) scale(0.95); }
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.3s var(--ease-out-expo);
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: modal-in 0.4s var(--ease-spring);
}

.modal-close {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.modal-close:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  background: rgba(201, 169, 110, 0.1);
  color: var(--color-accent);
  border: 1px solid rgba(201, 169, 110, 0.2);
}

/* ---------- Social Links ---------- */
.social-links {
  display: flex;
  gap: var(--space-4);
}

.social-link {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-normal) var(--ease-out-expo);
  color: var(--text-secondary);
}

.social-link:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* ============================================
   AI 智能客服 Widget
   ============================================ */

/* 触发按钮 */
.ai-chat-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary, #2c2c2c);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(201, 169, 98, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-chat-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(201, 169, 98, 0.5);
}

.ai-chat-trigger svg {
  width: 24px;
  height: 24px;
  transition: all 0.3s ease;
}

.ai-chat-icon-close,
.ai-chat-active .ai-chat-icon-open { display: none; }
.ai-chat-active .ai-chat-icon-close { display: block; }

.ai-chat-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #27ae60;
  border: 2px solid #fff;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* 聊天面板 */
.ai-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9997;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border-light);
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-chat-panel.ai-chat-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* 头部 */
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.ai-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-primary, #2c2c2c), var(--color-accent, #c9a962));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  font-family: 'Playfair Display', serif;
}

.ai-chat-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.ai-chat-status {
  font-size: 12px;
  color: #27ae60;
}

.ai-chat-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ai-chat-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* 消息区 */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 2px;
}

.ai-chat-msg {
  display: flex;
  animation: msg-in 0.3s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-chat-msg-user { justify-content: flex-end; }
.ai-chat-msg-bot { justify-content: flex-start; }

.ai-chat-bubble {
  max-width: 82%;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-line;
  word-break: break-word;
}

.ai-chat-msg-user .ai-chat-bubble {
  background: var(--color-primary, #2c2c2c);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.ai-chat-msg-bot .ai-chat-bubble {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}

/* 打字动画 */
.ai-chat-typing .ai-chat-bubble {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}

.ai-chat-typing .ai-chat-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: typing-bounce 1.4s infinite both;
}

.ai-chat-typing .ai-chat-bubble span:nth-child(2) { animation-delay: 0.2s; }
.ai-chat-typing .ai-chat-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* 快捷提问 */
.ai-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border-light);
}

.ai-chat-quick button {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-medium);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-chat-quick button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(196, 139, 125, 0.06);
}

/* 输入区 */
.ai-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.ai-chat-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 24px;
  border: 1px solid var(--border-medium);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.ai-chat-input:focus {
  border-color: var(--color-primary);
}

.ai-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary, #2c2c2c);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-chat-send svg { width: 18px; height: 18px; }

.ai-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 12px rgba(196, 139, 125, 0.4);
}

/* 移动端适配 */
@media (max-width: 480px) {
  .ai-chat-trigger {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }

  .ai-chat-panel {
    bottom: 76px;
    right: 8px;
    width: calc(100vw - 16px);
    height: calc(100vh - 120px);
    max-height: none;
    border-radius: 16px;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }

  .btn-lg {
    padding: 0.75rem 2rem;
    font-size: var(--text-sm);
  }
}
