/**
 * LYG 邮箱设计系统
 * 基于 Gmail 和 Material Design 3.0
 * 版本: 2.0
 */

/* ============================================
   1. 颜色系统 (Color System)
   ============================================ */

:root {
  /* 主色调 (Primary Colors) */
  --color-primary: #1a73e8;
  --color-primary-hover: #1765cc;
  --color-primary-active: #1557b0;
  --color-primary-light: #e8f0fe;
  --color-primary-lighter: #f1f7ff;
  
  /* 辅助色 (Secondary Colors) */
  --color-success: #34a853;
  --color-success-light: #e6f4ea;
  --color-warning: #fbbc04;
  --color-warning-light: #fef7e0;
  --color-error: #ea4335;
  --color-error-light: #fce8e6;
  --color-info: #4285f4;
  --color-info-light: #e8f0fe;
  
  /* 功能色 (Functional Colors) */
  --color-star: #f9ab00;
  --color-important: #ea4335;
  --color-link: #1a73e8;
  
  /* 灰度系统 (Grayscale) */
  --color-gray-900: #202124;  /* 主要文本 */
  --color-gray-700: #5f6368;  /* 次要文本 */
  --color-gray-500: #80868b;  /* 辅助文本 */
  --color-gray-300: #dadce0;  /* 边框 */
  --color-gray-100: #f1f3f4;  /* 背景 */
  --color-gray-50: #f8f9fa;   /* 浅背景 */
  
  /* 背景色层次 (Background Layers) */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #f8f9fa;
  --bg-hover: #f1f3f4;
  --bg-selected: #e8f0fe;
  --bg-overlay: rgba(0, 0, 0, 0.6);
  
  /* 文本颜色 (Text Colors) */
  --text-primary: var(--color-gray-900);
  --text-secondary: var(--color-gray-700);
  --text-tertiary: var(--color-gray-500);
  --text-disabled: var(--color-gray-300);
  --text-inverse: #ffffff;
  --text-link: var(--color-link);
  
  /* 边框颜色 (Border Colors) */
  --border-primary: var(--color-gray-300);
  --border-secondary: var(--color-gray-100);
  --border-focus: var(--color-primary);
  
  /* 阴影颜色 (Shadow Colors) */
  --shadow-color: rgba(0, 0, 0, 0.1);
  --shadow-color-dark: rgba(0, 0, 0, 0.15);
  --shadow-color-darker: rgba(0, 0, 0, 0.3);
}

/* 深色模式 (Dark Mode) - 预留 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #202124;
    --bg-secondary: #292a2d;
    --bg-tertiary: #35363a;
    --bg-hover: #3c4043;
    --bg-selected: #1a2a3a;
    
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-tertiary: #5f6368;
    
    --border-primary: #5f6368;
    --border-secondary: #3c4043;
  }
}

/* ============================================
   2. 字体系统 (Typography System)
   ============================================ */

:root {
  /* 字体家族 (Font Families) */
  --font-primary: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  --font-mono: 'Roboto Mono', 'SF Mono', 'Courier New', monospace;
  
  /* 字号 (Font Sizes) */
  --font-size-xs: 12px;    /* 微字 */
  --font-size-sm: 13px;    /* 小字 */
  --font-size-base: 14px;  /* 正文 */
  --font-size-md: 16px;    /* 中标题 */
  --font-size-lg: 20px;    /* 大标题 */
  --font-size-xl: 24px;    /* 超大标题 */
  
  /* 行高 (Line Heights) */
  --line-height-tight: 1.4;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;
  
  /* 字重 (Font Weights) */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;
}

/* ============================================
   3. 间距系统 (Spacing System)
   ============================================ */

:root {
  /* 基础单位: 8px */
  --space-0: 0;
  --space-1: 4px;    /* 0.5x */
  --space-2: 8px;    /* 1x - 基础单位 */
  --space-3: 12px;   /* 1.5x */
  --space-4: 16px;   /* 2x */
  --space-5: 20px;   /* 2.5x */
  --space-6: 24px;   /* 3x */
  --space-8: 32px;   /* 4x */
  --space-10: 40px;  /* 5x */
  --space-12: 48px;  /* 6x */
  --space-16: 64px;  /* 8x */
  --space-20: 80px;  /* 10x */
}

/* ============================================
   4. 圆角系统 (Border Radius System)
   ============================================ */

:root {
  --radius-none: 0;
  --radius-sm: 4px;     /* 小圆角 - 输入框 */
  --radius-md: 8px;     /* 中圆角 - 卡片、菜单 */
  --radius-lg: 16px;    /* 大圆角 - 按钮、面板 */
  --radius-xl: 20px;    /* 超大圆角 - 主要按钮 */
  --radius-full: 9999px; /* 全圆角 - 圆形按钮、标签 */
}

/* ============================================
   5. 阴影系统 (Shadow System)
   ============================================ */

:root {
  /* 阴影层级 */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.2), 0 16px 32px rgba(0, 0, 0, 0.2);
  
  /* 特殊阴影 */
  --shadow-focus: 0 0 0 2px var(--color-primary-light);
  --shadow-error: 0 0 0 2px var(--color-error-light);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  
  /* 悬停阴影 */
  --shadow-hover: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px rgba(60, 64, 67, 0.15);
  --shadow-hover-lg: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px rgba(60, 64, 67, 0.15);
}

/* ============================================
   6. 动画系统 (Animation System)
   ============================================ */

:root {
  /* 动画时长 */
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 500ms;
  
  /* 缓动函数 */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --ease-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* 过渡 */
  --transition-fast: all var(--duration-fast) var(--ease-standard);
  --transition-normal: all var(--duration-normal) var(--ease-standard);
  --transition-slow: all var(--duration-slow) var(--ease-standard);
}

/* ============================================
   7. Z-Index 系统 (Z-Index System)
   ============================================ */

:root {
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-notification: 1080;
}

/* ============================================
   8. 断点系统 (Breakpoint System)
   ============================================ */

:root {
  --breakpoint-xs: 0;
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1440px;
  --breakpoint-xxl: 1920px;
}

/* ============================================
   9. 尺寸系统 (Size System)
   ============================================ */

:root {
  /* 图标尺寸 */
  --icon-xs: 16px;
  --icon-sm: 20px;
  --icon-md: 24px;
  --icon-lg: 32px;
  --icon-xl: 48px;
  
  /* 按钮尺寸 */
  --button-height-sm: 32px;
  --button-height-md: 36px;
  --button-height-lg: 40px;
  --button-height-xl: 48px;
  
  /* 输入框尺寸 */
  --input-height-sm: 32px;
  --input-height-md: 40px;
  --input-height-lg: 48px;
  
  /* 头像尺寸 */
  --avatar-xs: 24px;
  --avatar-sm: 32px;
  --avatar-md: 40px;
  --avatar-lg: 48px;
  --avatar-xl: 64px;
  
  /* 布局尺寸 */
  --header-height: 64px;
  --sidebar-width: 256px;
  --sidebar-collapsed-width: 72px;
  --toolbar-height: 48px;
  --email-row-height: 46px;
  --detail-panel-width: 800px;
}

/* ============================================
   10. 全局重置 (Global Reset)
   ============================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

/* ============================================
   11. 工具类 (Utility Classes)
   ============================================ */

/* 文本颜色 */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-error { color: var(--color-error); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

/* 背景颜色 */
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-hover { background-color: var(--bg-hover); }
.bg-selected { background-color: var(--bg-selected); }

/* 字重 */
.font-regular { font-weight: var(--font-weight-regular); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-bold { font-weight: var(--font-weight-bold); }

/* 字号 */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-md { font-size: var(--font-size-md); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }

/* 圆角 */
.rounded-none { border-radius: var(--radius-none); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* 阴影 */
.shadow-none { box-shadow: none; }
.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* 过渡 */
.transition-fast { transition: var(--transition-fast); }
.transition-normal { transition: var(--transition-normal); }
.transition-slow { transition: var(--transition-slow); }

/* 显示/隐藏 */
.hidden { display: none !important; }
.visible { display: block !important; }

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* 间距 */
.m-0 { margin: 0; }
.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* 宽高 */
.w-full { width: 100%; }
.h-full { height: 100%; }

/* 溢出 */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* 光标 */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

/* 用户选择 */
.select-none { user-select: none; }

/* ============================================
   12. 滚动条样式 (Scrollbar Styles)
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-500);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-gray-300) transparent;
}

/* ============================================
   13. 焦点样式 (Focus Styles)
   ============================================ */

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   14. 选择样式 (Selection Styles)
   ============================================ */

::selection {
  background-color: var(--color-primary-light);
  color: var(--text-primary);
}

::-moz-selection {
  background-color: var(--color-primary-light);
  color: var(--text-primary);
}

/* ============================================
   15. 打印样式 (Print Styles)
   ============================================ */

@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }
  
  thead {
    display: table-header-group;
  }
  
  tr,
  img {
    page-break-inside: avoid;
  }
  
  img {
    max-width: 100% !important;
  }
  
  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }
  
  h2,
  h3 {
    page-break-after: avoid;
  }
}




