/* 浅渡论坛样式 - shadcn inspired */

/* 导入字体 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* shadcn 色彩变量 */
  --background: 222 47% 11%;
  --foreground: 210 40% 98%;
  --card: 222 47% 14%;
  --card-foreground: 210 40% 98%;
  --popover: 222 47% 11%;
  --popover-foreground: 210 40% 98%;
  --primary: 258 90% 66%;
  --primary-foreground: 210 40% 98%;
  --secondary: 217 33% 17%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217 33% 17%;
  --muted-foreground: 215 20% 65%;
  --accent: 217 33% 17%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 63% 31%;
  --destructive-foreground: 210 40% 98%;
  --border: 217 33% 20%;
  --input: 217 33% 20%;
  --ring: 258 90% 66%;
  --radius: 0.5rem;
}

* {
  border-color: hsl(var(--border));
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

a {
  text-decoration: none;
  color: inherit;
}

a:hover {
  text-decoration: none;
}

/* ===== 卡片样式 (shadcn Card) ===== */
.forum-card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  transition: all 0.2s ease;
}

.forum-card:hover {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  border-color: hsl(var(--primary) / 0.5);
}

/* ===== 按钮样式 (shadcn Button) ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  height: 2.5rem;
  padding: 0 1rem;
  border: none;
}

.btn-primary:hover {
  background-color: hsl(var(--primary) / 0.9);
  box-shadow: 0 2px 8px hsl(var(--primary) / 0.4);
}

.btn-primary:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid hsl(var(--border));
}

.btn-secondary:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  background-color: transparent;
  color: hsl(var(--foreground));
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid hsl(var(--border));
}

.btn-outline:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-destructive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  height: 2.5rem;
  padding: 0 1rem;
  border: none;
}

.btn-destructive:hover {
  background-color: hsl(var(--destructive) / 0.9);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  background-color: transparent;
  color: hsl(var(--foreground));
  height: 2.5rem;
  padding: 0 1rem;
  border: none;
}

.btn-ghost:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-sm {
  height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.813rem;
}

.btn-lg {
  height: 2.75rem;
  padding: 0 2rem;
  font-size: 1rem;
}

.btn-icon {
  width: 2.5rem;
  padding: 0;
}

/* ===== 输入框样式 (shadcn Input) ===== */
.input-field {
  display: flex;
  height: 2.5rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: all 0.2s ease;
}

.input-field::placeholder {
  color: hsl(var(--muted-foreground));
}

.input-field:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.3);
}

.textarea-field {
  display: flex;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  min-height: 6rem;
  resize: vertical;
  transition: all 0.2s ease;
  font-family: inherit;
}

.textarea-field::placeholder {
  color: hsl(var(--muted-foreground));
}

.textarea-field:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.3);
}

/* ===== 标签样式 (shadcn Badge) ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.625rem;
  transition: all 0.2s ease;
}

.badge-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.badge-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.badge-destructive {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.badge-outline {
  background-color: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

.badge-success {
  background-color: hsl(142 76% 36%);
  color: white;
}

/* ===== 导航栏 ===== */
nav {
  background-color: hsl(var(--background) / 0.95) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}

/* ===== Flash 消息 (shadcn Alert inspired) ===== */
.flash-message {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid;
  padding: 1rem;
  animation: slideIn 0.3s ease;
}

.flash-success {
  background-color: hsl(143 85% 96%);
  border-color: hsl(145 92% 36%);
  color: hsl(145 92% 26%);
}

.flash-error {
  background-color: hsl(0 93% 96%);
  border-color: hsl(0 84% 60%);
  color: hsl(0 84% 40%);
}

.flash-info {
  background-color: hsl(214 95% 96%);
  border-color: hsl(213 94% 68%);
  color: hsl(213 94% 48%);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 话题列表项 ===== */
.topic-item {
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  padding: 1rem 1.25rem;
}

.topic-item:hover {
  border-left-color: hsl(var(--primary));
  background-color: hsl(var(--accent) / 0.5);
}

/* ===== 评论区样式 ===== */
.comment-item {
  transition: all 0.2s ease;
  padding: 1rem;
  border-radius: var(--radius);
}

.comment-item:hover {
  background-color: hsl(var(--accent) / 0.3);
}

/* ===== 点赞按钮动画 ===== */
.like-btn {
  transition: all 0.2s ease;
}

.like-btn:hover {
  transform: scale(1.1);
}

.like-btn.liked {
  color: hsl(var(--primary));
}

/* ===== 分页按钮 ===== */
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  height: 2.25rem;
  padding: 0 0.75rem;
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border: 1px solid hsl(var(--border));
}

.pagination a:hover {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

/* ===== 表单标签 (shadcn Label) ===== */
.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
  display: block;
}

.form-label-required::after {
  content: " *";
  color: hsl(var(--destructive));
}

/* ===== 用户头像 (shadcn Avatar inspired) ===== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(330 81% 60%));
  color: white;
  font-weight: 600;
  overflow: hidden;
}

.avatar-sm {
  width: 2rem;
  height: 2rem;
  font-size: 0.75rem;
}

.avatar-md {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1rem;
}

.avatar-lg {
  width: 4rem;
  height: 4rem;
  font-size: 1.5rem;
}

/* ===== 统计卡片 ===== */
.stat-card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: hsl(var(--primary) / 0.5);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.2);
}

.stat-card .stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.813rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.375rem;
}

/* ===== 置顶标签闪光效果 ===== */
.pinned-badge {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: hsl(var(--background));
}

::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.5);
}

/* ===== 分隔线 ===== */
.divider {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin: 1rem 0;
}

/* ===== 空状态 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1.125rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

.empty-state-desc {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground) / 0.7);
}

/* ===== 下拉菜单 (shadcn Dropdown inspired) ===== */
.dropdown-content {
  background-color: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
  padding: 0.25rem;
  min-width: 8rem;
  z-index: 50;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
  color: hsl(var(--popover-foreground));
}

.dropdown-item:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* ===== 表格样式 (shadcn Table) ===== */
.table-wrapper {
  width: 100%;
  overflow: auto;
}

.table {
  width: 100%;
  caption-side: bottom;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  height: 3rem;
  padding: 0 1rem;
  text-align: left;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border));
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.table tr:hover {
  background-color: hsl(var(--muted) / 0.5);
}

/* ===== 切换开关 (shadcn Switch inspired) ===== */
.switch {
  position: relative;
  display: inline-flex;
  height: 1.5rem;
  width: 2.75rem;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 9999px;
  border: 2px solid transparent;
  background-color: hsl(var(--muted));
  transition: all 0.2s ease;
}

.switch.checked {
  background-color: hsl(var(--primary));
}

.switch-thumb {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background-color: white;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
  transition: all 0.2s ease;
  transform: translateX(0);
}

.switch.checked .switch-thumb {
  transform: translateX(1.25rem);
}
