/* ========== 核心基础样式 - 整合版 ========== */
/* 整合: typography-unified.css + buttons-simplified.css + 基础响应式 */

/* ========== CSS变量系统 ========== */
:root {
    /* 主色调 */
    --primary-color: #d32f2f;
    --primary-dark: #b71c1c;
    --primary-color-rgb: 211, 47, 47;
    --secondary-color: #d32f2f;
    --accent-color: #ff6b35;

    /* 中性色 */
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e9ecef;

    /* 状态颜色 */
    --success-color: #25D366;
    --warning-color: #ff9800;
    --danger-color: #dc3545;
    --info-color: #2196f3;

    /* 主字体族 */
    --font-family-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    --font-family-display: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', serif;

    /* 字体大小系统 */
    --font-size-xs: 0.75rem;     /* 12px */
    --font-size-sm: 0.875rem;    /* 14px */
    --font-size-base: 1rem;      /* 16px */
    --font-size-lg: 1.125rem;    /* 18px */
    --font-size-xl: 1.25rem;     /* 20px */
    --font-size-2xl: 1.5rem;     /* 24px */
    --font-size-3xl: 1.875rem;   /* 30px */
    --font-size-4xl: 2.25rem;    /* 36px */
    --font-size-5xl: 3rem;       /* 48px */

    /* 字体权重 */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* 行高系统 */
    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.6;
    --line-height-loose: 1.8;

    /* 响应式断点 */
    --breakpoint-xs: 475px;
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;

    /* 间距系统 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* 容器最大宽度 */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1536px;
}

/* ========== 基础重置样式 ========== */
* {
    box-sizing: border-box;
    font-family: var(--font-family-primary);
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background: var(--bg-white);
    margin: 0;
    padding: 0;
}

/* ========== 标题系统 ========== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-primary);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

h1 { font-size: var(--font-size-5xl); }
h2 { font-size: var(--font-size-4xl); }
h3 { font-size: var(--font-size-3xl); }
h4 { font-size: var(--font-size-2xl); }
h5 { font-size: var(--font-size-xl); }
h6 { font-size: var(--font-size-lg); }

/* ========== 文本元素 ========== */
p {
    margin: 0 0 1rem 0;
    line-height: var(--line-height-normal);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* ========== 容器系统 ========== */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

@media (min-width: 640px) {
    .container {
        max-width: var(--container-sm);
        padding: 0 var(--spacing-lg);
    }
}

@media (min-width: 768px) {
    .container {
        max-width: var(--container-md);
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: var(--container-lg);
        padding: 0 var(--spacing-xl);
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: var(--container-xl);
    }
}

/* ========== 按钮系统 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid transparent;
    border-radius: 6px;
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(197, 55, 55, 0.3);
}

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

/* 主要按钮 */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

/* 次要按钮 */
.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* 轮廓按钮 */
.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-light);
    border-color: var(--text-secondary);
}

/* 按钮尺寸变体 */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
}

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

/* ========== 实用工具类 ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

.bg-light { background: var(--bg-light); }
.bg-white { background: var(--bg-white); }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.m-0 { margin: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mr-1 { margin-right: var(--spacing-sm); }
.ml-1 { margin-left: var(--spacing-sm); }

.mt-2 { margin-top: var(--spacing-md); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mr-2 { margin-right: var(--spacing-md); }
.ml-2 { margin-left: var(--spacing-md); }

.mt-3 { margin-top: var(--spacing-lg); }
.mb-3 { margin-bottom: var(--spacing-lg); }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }

/* ========== 响应式显示控制 ========== */
@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .hide-tablet { display: none !important; }
}

@media (min-width: 1024px) {
    .hide-desktop { display: none !important; }
}

/* ========== 移动端触摸优化 ========== */
@media (max-width: 768px) {
    /* 全局触摸高亮颜色 */
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    }

    /* 按钮和链接触摸优化 */
    button,
    a,
    .btn,
    [role="button"],
    [onclick] {
        -webkit-tap-highlight-color: rgba(211, 47, 47, 0.1);
        touch-action: manipulation; /* 移除300ms点击延迟 */
    }

    /* 确保触摸目标最小尺寸 (iOS Human Interface Guidelines) */
    button,
    .btn,
    a.btn,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* 输入框优化 */
    input,
    textarea,
    select {
        font-size: 16px; /* 防止iOS自动缩放 */
        -webkit-appearance: none;
        border-radius: 4px;
    }

    /* 禁用某些元素的选择 */
    .no-select,
    button,
    .btn {
        -webkit-user-select: none;
        user-select: none;
    }

    /* 滚动优化 */
    .scrollable {
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }

    /* 防止文本缩放 */
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* ========== 小屏幕进一步优化 ========== */
@media (max-width: 480px) {
    /* 减小容器padding */
    .container {
        padding: 0 var(--spacing-sm);
    }

    /* 标题尺寸调整 */
    h1 { font-size: var(--font-size-3xl); }
    h2 { font-size: var(--font-size-2xl); }
    h3 { font-size: var(--font-size-xl); }
    h4 { font-size: var(--font-size-lg); }
}