/* 自定义样式补充Tailwind CSS */

/* 基础样式重置 */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* 图表容器样式 */
.chart-container {
    position: relative;
    min-height: 400px;
    border-radius: 0.5rem;
    overflow: hidden;
}

/* 加载动画 */
.loading-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 图表卡片样式 */
.chart-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    overflow: hidden;
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 暗色主题支持 */
.dark .chart-card {
    background: #1f2937;
    border-color: #374151;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chart-container {
        min-height: 300px;
    }
    
    .chart-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .chart-controls > * {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .chart-container {
        min-height: 250px;
    }
    
    nav .flex.space-x-4 {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-track {
    background: #374151;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* 按钮样式增强 */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.dark .btn-secondary {
    background: #374151;
    color: #d1d5db;
    border-color: #4b5563;
}

.dark .btn-secondary:hover {
    background: #4b5563;
    border-color: #6b7280;
}

/* 输入框样式 */
.input-field {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: white;
    color: #111827;
    transition: all 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .input-field {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark .input-field:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* 模态框动画 */
.modal-enter {
    animation: modalEnter 0.3s ease-out;
}

.modal-leave {
    animation: modalLeave 0.2s ease-in;
}

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

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

/* 提示消息动画 */
.toast-enter {
    animation: toastEnter 0.3s ease-out;
}

.toast-leave {
    animation: toastLeave 0.2s ease-in;
}

@keyframes toastEnter {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastLeave {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 图表加载动画 */
.chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.dark .chart-loading {
    background: rgba(31, 41, 55, 0.9);
}

/* 主题颜色定义 */
.theme-blue {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --bg-primary: #eff6ff;
    --text-primary: #1e40af;
}

.theme-green {
    --primary-color: #10b981;
    --primary-dark: #047857;
    --bg-primary: #ecfdf5;
    --text-primary: #065f46;
}

.theme-purple {
    --primary-color: #8b5cf6;
    --primary-dark: #7c3aed;
    --bg-primary: #faf5ff;
    --text-primary: #5b21b6;
}

/* 打印样式 */
@media print {
    nav, footer, .chart-controls {
        display: none !important;
    }
    
    .chart-container {
        height: 500px !important;
        break-inside: avoid;
    }
}

/* 无障碍支持 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 焦点样式 */
.focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .chart-card {
        border: 2px solid #000;
    }
    
    .btn-primary {
        border: 2px solid #000;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}