/**
 * 兰台智笔 - 主样式文件
 * Main Stylesheet for Lantai Zhibi
 * Version: 1.0.0
 */

/* ===== 全局样式 Global Styles ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background-color: #f8f9fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== 导航栏 Navbar ===== */
.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

/* ===== 侧边栏 Sidebar ===== */
.sidebar {
    min-height: calc(100vh - 56px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    background-color: #f8f9fa;
}

.sidebar .nav-link {
    color: #333;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease-in-out;
}

.sidebar .nav-link:hover {
    background-color: #e9ecef;
    color: #0d6efd;
}

.sidebar .nav-link.active {
    background-color: #0d6efd;
    color: white;
}

/* ===== 主内容区 Main Content ===== */
.main-content {
    padding: 2rem;
}

/* ===== 卡片 Cards ===== */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* ===== 等级徽章 Tier Badges ===== */
.tier-badge {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.tier-free {
    background-color: #6c757d;
    color: white;
}

.tier-personal {
    background-color: #0dcaf0;
    color: white;
}

.tier-professional {
    background-color: #0d6efd;
    color: white;
}

.tier-team {
    background-color: #6610f2;
    color: white;
}

.tier-enterprise {
    background-color: #dc3545;
    color: white;
}

/* ===== 进度条 Progress Bar ===== */
.usage-progress {
    height: 8px;
    border-radius: 4px;
}

/* ===== 提示框 Alerts ===== */
.alert {
    border-radius: 0.5rem;
    border: none;
}

/* ===== 页脚 Footer ===== */
footer {
    margin-top: 3rem;
    padding: 2rem 0;
    background-color: #343a40;
    color: white;
    text-align: center;
}

footer p {
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}

footer .text-light-secondary {
    color: rgba(255, 255, 255, 0.75);
}

/* ===== 图片懒加载 Lazy Loading ===== */
img {
    max-width: 100%;
    height: auto;
}

/* 加载占位符 */
.lazy-load-placeholder {
    background-color: #f0f0f0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

/* ===== 表单优化 Form Optimization ===== */
.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ===== 按钮优化 Button Optimization ===== */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
}

/* ===== 表格优化 Table Optimization ===== */
.table {
    --bs-table-bg: transparent;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

/* ===== 分页 Pagination ===== */
.pagination {
    margin-top: 1rem;
}

.page-link {
    color: #0d6efd;
    border: 1px solid #dee2e6;
    margin: 0 0.125rem;
    border-radius: 0.25rem;
}

.page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* ===== 徽章 Badges ===== */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* ===== 下拉菜单 Dropdown ===== */
.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.2s ease-in-out;
}

/* ===== 模态框 Modal ===== */
.modal-content {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

/* ===== 工具提示 Tooltip ===== */
.tooltip {
    font-size: 0.875rem;
}

/* ===== 响应式优化 Responsive Optimization ===== */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .sidebar {
        min-height: auto;
    }
}

/* ===== 打印样式 Print Styles ===== */
@media print {
    .navbar,
    .sidebar,
    footer,
    .btn {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* ===== 动画优化 Animation Optimization ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 滚动条优化 Scrollbar Optimization (Webkit) ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* ===== 代码块 Code Blocks ===== */
pre {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
}

code {
    font-size: 0.875em;
    color: #d63384;
    background-color: rgba(13, 110, 253, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

/* ===== 加载动画 Loading Animation ===== */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* ===== 骨架屏 Skeleton Screen ===== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

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

/* ===== 性能优化：will-change ===== */
.btn,
.nav-link,
.card {
    will-change: transform;
}

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

/* ===== 焦点可见性 Focus Visibility ===== */
:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}
