/**
 * 基础样式文件
 * 路径: css/base.css
 * 版本: Delta7 - 优化版
 * 包含: CSS变量、全局重置、字体、基础布局
 */

/* ======================
   CSS 变量定义（全局主题配置）
   ====================== */
:root {
    /* 主题色 */
    --primary-gradient-start: #667eea;
    --primary-gradient-end: #764ba2;
    --primary-color: #667eea;
    
    /* 功能色 */
    --success-color: #10b981;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #3b82f6;
    
    /* 中性色 */
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #adb5bd;
    --gray-500: #6c757d;
    --gray-600: #495057;
    --gray-700: #343a40;
    --gray-800: #212529;
    
    /* 尺寸 */
    --row-height: 40px;
    --header-height: 50px;
    --default-cell-width: 50px;
    --sidebar-width: 180px;
    --sidebar-min-width: 100px;
    --sidebar-max-width: 400px;
    --toolbar-collapsed-size: 48px;
    --toolbar-border-radius: 20px;
    --card-border-radius: 12px;
    --button-border-radius: 12px;
    
    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(102, 126, 234, 0.4);
    --shadow-xl: 0 10px 30px rgba(0, 0, 0, 0.2);
    
    /* 过渡 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index 层级 */
    --z-toolbar-collapsed: 1000;
    --z-toolbar-expanded: 998;
    --z-settings-panel: 1001;
    --z-quick-menu: 1002;
    --z-inline-form: 1000;
    --z-gantt-bar-selected: 10;
    --z-gantt-label: 5;
    --z-resize-handle: 999;
}

/* ======================
   全局样式优化
   ====================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
                 "Helvetica Neue", Arial, "Noto Sans", sans-serif,
                 "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background: var(--gray-50);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--gray-800);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

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

input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 图标字体样式 */
.icon {
    font-style: normal;
    font-size: inherit;
}

/* 容器自适应布局 */
.container-fluid {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding: 15px;
    max-width: 100%;
    margin: 0 auto;
}

/* 标题渐变 */
h1 {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 滚动条样式优化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #212529;
        --gray-100: #343a40;
        --gray-200: #495057;
        --gray-300: #6c757d;
        --gray-400: #adb5bd;
        --gray-500: #dee2e6;
        --gray-600: #e9ecef;
        --gray-700: #f8f9fa;
        --gray-800: #ffffff;
    }

    body {
        background: var(--gray-50);
        color: var(--gray-800);
    }
}

/* 可访问性增强 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

@media (prefers-contrast: high) {
    .gantt-bar {
        border-width: 3px;
    }

    .toolbar-btn {
        border: 1px solid currentColor;
    }
}
