/* 灵动数智人 - 设计系统 CSS */

/* ===== CSS 变量 ===== */
:root {
  /* 背景色 */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-card: #15151f;
  --bg-hover: #1f1f2e;

  /* 文本色 */
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;

  /* 强调色 */
  --accent-primary: #00d9ff;
  --accent-secondary: #00ffaa;
  --accent-gradient: linear-gradient(135deg, #00d9ff 0%, #00ffaa 100%);

  /* 状态色 */
  --success: #00ff88;
  --warning: #ffaa00;
  --error: #ff4466;

  /* 边框色 */
  --border-color: #2a2a3a;

  /* 间距 */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* 圆角 */
  --border-radius-sm: 8px;
  --border-radius: 12px;
  --border-radius-lg: 16px;

  /* 阴影 */
  --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);
  --shadow-glow: 0 0 20px rgba(0, 217, 255, 0.3);

  /* 过渡 */
  --transition: all 0.3s ease;
  --transition-fast: all 0.15s ease;
}

/* ===== 文件预览样式 ===== */
.file-preview {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--border-color);
}

.file-preview img,
.file-preview video {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--border-radius-sm);
  display: block;
  margin: 0 auto;
}

.file-preview audio {
  width: 100%;
  margin-top: var(--space-sm);
}

.file-info {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.upload-area {
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}

.upload-area:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
}

.upload-area.drag-over {
  border-color: var(--accent-primary);
  background: rgba(0, 217, 255, 0.1);
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }
  
  .container {
    padding: var(--space-md);
  }
  
  nav .container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  nav ul {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  
  nav .nav-right {
    width: 100%;
    margin-top: var(--space-md);
    justify-content: space-between;
  }
  
  .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .tabs {
    flex-wrap: wrap;
  }
  
  .tab {
    flex: 1 1 auto;
    min-width: 80px;
    text-align: center;
  }
  
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  .flex-between {
    flex-direction: column;
    gap: var(--space-md);
    align-items: flex-start !important;
  }
  
  .flex-between .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }
  
  .card {
    padding: var(--space-md);
  }
  
  .file-preview img,
  .file-preview video {
    max-height: 250px;
  }
}

/* ===== 全局样式 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(0, 217, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(0, 255, 170, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ===== 排版 ===== */
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

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

a:hover {
  color: var(--accent-secondary);
}

/* ===== 容器 ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-sm {
  max-width: 600px;
}

.container-md {
  max-width: 900px;
}

/* ===== 导航栏 ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo img {
  height: 40px;
  width: auto;
}

.logo-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a:hover {
  transform: translateY(-2px);
}

.nav-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* ===== 按钮 ===== */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  display: inline-block;
}

.btn-primary {
  background: var(--accent-gradient);
  color: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 217, 255, 0.4);
}

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

.btn-secondary:hover {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  filter: brightness(1.2);
}

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

/* ===== 输入框 ===== */
.input-group {
  margin-bottom: var(--space-lg);
}

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: var(--transition);
}

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

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

/* ===== 徽章 ===== */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(0, 255, 136, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(255, 170, 0, 0.1);
  color: var(--warning);
}

.badge-error {
  background: rgba(255, 68, 102, 0.1);
  color: var(--error);
}

.badge-info {
  background: rgba(0, 217, 255, 0.1);
  color: var(--accent-primary);
}

/* ===== 加载动画 ===== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  top: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  z-index: 99999; /* 确保在所有弹窗之上 */
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-success {
  background: var(--success);
  color: var(--bg-primary);
}

.toast-error {
  background: var(--error);
  color: white;
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeIn 0.3s ease;
}

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

.modal {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mt-1 { margin-top: var(--space-md); }
.mt-2 { margin-top: var(--space-lg); }
.mb-1 { margin-bottom: var(--space-md); }
.mb-2 { margin-bottom: var(--space-lg); }

.grid {
  display: grid;
  gap: 1.5rem;
}

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

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  .nav-links {
    display: none;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .toast {
    right: 1rem;
    left: 1rem;
  }
}

/* ===== 用户菜单样式 ===== */
.user-menu {
  position: relative;
  display: inline-block;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-icon {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.user-menu-btn:hover .dropdown-icon {
  transform: rotate(180deg);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  overflow: hidden;
}

.user-menu-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-dropdown a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.2s ease;
  font-size: 0.9rem;
}

.user-menu-dropdown a:hover {
  background: var(--bg-hover);
  color: var(--accent-primary);
}

.menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

/* 响应式 - 移动端用户菜单 */
@media (max-width: 768px) {
  .user-menu-btn {
    max-width: 150px;
    font-size: 0.85rem;
  }

  .user-menu-dropdown {
    min-width: 160px;
  }
}

/* ===== 模态弹窗样式 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

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

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

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

.modal-body {
  padding: 1.5rem;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: flex-end;
}

.modal-actions .btn {
  min-width: 100px;
}

/* 响应式 - 移动端模态框 */
@media (max-width: 768px) {
  .modal-dialog {
    width: 95%;
    max-width: none;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-header h3 {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }
}

