/* ============================================================
   ManagerInsight 全局基础样式 (Base / Reset) v3.0
   ============================================================
   CSS Reset + 全局基础排版 + 入场动画 + 滚动行为
   依赖: variables.css (必须在此文件之前引入)
   ============================================================ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--mi-font-sans);
    color: var(--mi-text-primary);
    background: var(--mi-bg-page);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    font-variant-numeric: tabular-nums;
}

/* ---- 排版 ---- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--mi-text-primary);
    letter-spacing: -0.01em;
}

h1 { font-size: var(--mi-text-4xl); letter-spacing: -0.025em; }
h2 { font-size: var(--mi-text-3xl); letter-spacing: -0.02em; }
h3 { font-size: var(--mi-text-2xl); letter-spacing: -0.015em; }
h4 { font-size: var(--mi-text-xl); }
h5 { font-size: var(--mi-text-lg); }
h6 { font-size: var(--mi-text-md); }

p {
    font-size: var(--mi-text-base);
    color: var(--mi-text-secondary);
    line-height: 1.6;
}

a {
    color: var(--mi-cta);
    text-decoration: none;
    transition: color var(--mi-duration-fast) var(--mi-ease-in-out);
}

a:hover {
    color: var(--mi-cta-hover);
}

/* ---- 图片 ---- */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ---- 表格基础 ---- */
table {
    border-collapse: collapse;
    width: 100%;
}

/* ---- 表单基础 ---- */
input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* ---- 滚动条美化 (WebKit) ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--mi-gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--mi-gray-400);
}

/* ---- 选中文本高亮 ---- */
::selection {
    background: rgba(3, 105, 161, 0.12);
    color: var(--mi-text-primary);
}

/* ---- 焦点可访问性 ---- */
:focus-visible {
    outline: 2px solid var(--mi-cta);
    outline-offset: 2px;
}

/* ---- 动画关键帧 ---- */
@keyframes mi-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

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

@keyframes mi-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes mi-slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes mi-slide-in-right {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes mi-scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes mi-blur-in {
    from { opacity: 0; filter: blur(8px); transform: translateY(8px); }
    to   { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@keyframes mi-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes mi-pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes mi-progress-bar {
    from { width: 100%; }
    to { width: 0%; }
}

/* ---- 入场动画工具类 ---- */
.mi-animate-in {
    animation: mi-slide-up var(--mi-duration-slow) var(--mi-ease-spring) both;
}

.mi-animate-fade {
    animation: mi-fade-in var(--mi-duration-normal) var(--mi-ease-in-out) both;
}

.mi-animate-scale {
    animation: mi-scale-in var(--mi-duration-slow) var(--mi-ease-spring) both;
}

.mi-animate-blur {
    animation: mi-blur-in var(--mi-duration-slower) var(--mi-ease-spring) both;
}

/* Stagger delays for child elements */
.mi-stagger > *:nth-child(1) { animation-delay: 0ms; }
.mi-stagger > *:nth-child(2) { animation-delay: 50ms; }
.mi-stagger > *:nth-child(3) { animation-delay: 100ms; }
.mi-stagger > *:nth-child(4) { animation-delay: 150ms; }
.mi-stagger > *:nth-child(5) { animation-delay: 200ms; }
.mi-stagger > *:nth-child(6) { animation-delay: 250ms; }
.mi-stagger > *:nth-child(7) { animation-delay: 300ms; }
.mi-stagger > *:nth-child(8) { animation-delay: 350ms; }

/* ---- 骨架屏 ---- */
.mi-skeleton {
    background: linear-gradient(90deg, var(--mi-gray-100) 25%, var(--mi-gray-200) 50%, var(--mi-gray-100) 75%);
    background-size: 200% 100%;
    animation: mi-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--mi-radius-md);
}

.mi-skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.mi-skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 12px;
    border-radius: 4px;
}

.mi-skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--mi-radius-full);
}
