/* ============================================================
   大陶匠社区V2 - 独立全局样式
   完全独立，不依赖主站任何CSS
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f5f0e8;
  color: #3d3d3d;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
}

/* ===== 设计变量 ===== */
:root {
  --color-primary: #8B4513;
  --color-primary-dark: #6d360f;
  --color-primary-light: #D96A1F;
  --color-primary-gradient: linear-gradient(135deg, #8B4513, #D96A1F);
  
  --bg-page: #f5f0e8;
  --bg-card: #fff;
  --bg-hover: #f0ede8;
  --bg-mask: rgba(0, 0, 0, 0.5);
  
  --text-primary: #3d3d3d;
  --text-secondary: #666;
  --text-tertiary: #999;
  --text-white: #fff;
  
  --border-color: #e8e0d6;
  --border-light: #f0f0f0;
  
  --color-danger: #FF2442;
  --color-success: #4caf50;
  
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ===== 工具类 ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-tertiary); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ===== 按钮 ===== */
.v2-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
}

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

.v2-btn-primary {
  background: var(--color-primary-gradient);
  color: var(--text-white);
}

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

/* ===== 卡片 ===== */
.v2-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ===== 头像 ===== */
.v2-avatar {
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-hover);
  flex-shrink: 0;
}

.v2-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.v2-avatar-sm { width: 24px; height: 24px; }
.v2-avatar-md { width: 36px; height: 36px; }
.v2-avatar-lg { width: 48px; height: 48px; }

/* ===== 加载动画 ===== */
.v2-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: v2-spin 0.8s linear infinite;
}

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

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 69, 19, 0.2);
  border-radius: 2px;
}

/* ===== 选中文本 ===== */
::selection {
  background: rgba(139, 69, 19, 0.15);
  color: #3d3d3d;
}



/* ===== 响应式布局 ===== */
.v2-container {
  width: 100%;
  margin: 0 auto;
  padding: 0 12px;
}

/* 平板及以上 */
@media (min-width: 768px) {
  .v2-container {
    max-width: 750px;
    padding: 0 16px;
  }
  
  .v2-page {
    padding-bottom: 0 !important;
  }
}

/* 电脑端 */
@media (min-width: 1024px) {
  .v2-container {
    max-width: 1000px;
  }
}

/* 大屏 */
@media (min-width: 1280px) {
  .v2-container {
    max-width: 1200px;
  }
}

/* ===== 浏览器兼容性 ===== */
/* iOS Safari 点击高亮去除 */
* {
  -webkit-tap-highlight-color: transparent;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* 文本溢出 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* flex 兼容性 */
.flex {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.flex-center {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}

/* 渐变兼容性 */
.v2-gradient {
  background: -webkit-linear-gradient(135deg, #8B4513, #D96A1F);
  background: linear-gradient(135deg, #8B4513, #D96A1F);
}

/* 动画兼容性 */
@-webkit-keyframes v2-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.v2-fade-in {
  -webkit-animation: v2-fade-in 0.3s ease;
  animation: v2-fade-in 0.3s ease;
}

/* 安全区域适配 */
@supports (padding: max(0px)) {
  .safe-area-bottom {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  
  .safe-area-top {
    padding-top: max(12px, env(safe-area-inset-top));
  }
}



/* 修复：禁止水平滚动，防止页面左右滑动 */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

