/* 全局样式 */
:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --border-color: #e5e7eb;
    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --bg-light: #f8f9fa;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ====== 导航栏样式 ====== */
.navbar {
    box-shadow: var(--shadow-md);
    padding: 12px 0;
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, #0a4d3a 0%, #0d7c66 100%) !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.navbar-brand i {
    font-size: 1.1rem;
}

/* ====== 标签页样式 ====== */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
    background: white;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 8px 8px 0;
    box-shadow: var(--shadow-sm);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    font-weight: 600;
    border: none;
    padding: 14px 24px;
    margin-right: 4px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    position: relative;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: white;
    border-bottom: 3px solid var(--primary-color);
    font-weight: 700;
}

.nav-tabs .nav-link i {
    font-size: 1rem;
}

/* ====== 卡片样式 ====== */
.card {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* ====== 文件列表样式 ====== */
.list-group-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm) !important;
    margin-bottom: 10px;
    padding: 16px 18px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: white;
}

.list-group-item:hover {
    background-color: #f0f7ff;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.list-group-item.active {
    background: linear-gradient(135deg, #e6f0ff 0%, #cce5ff 100%);
    border-color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
}

.list-group-item h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.list-group-item small {
    font-size: 0.8rem;
}

/* ====== 文件预览容器 ====== */
.file-preview-container {
    min-height: 500px;
    background-color: white;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
    position: relative;
}

.file-preview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    min-height: 500px;
}

/* 文件预览工具栏 */
.preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(to bottom, #f8f9fa, #fff);
    border-bottom: 1px solid var(--border-color);
}

.preview-toolbar .btn-group {
    display: flex;
    gap: 8px;
}

/* ====== 数据概览卡片 ====== */
.stats-card {
    background: linear-gradient(135deg, var(--bg-light) 0%, white 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stats-card .stats-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.4rem;
}

.stats-card .stats-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

.stats-card .stats-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 不同颜色的统计卡片 */
.stats-card.primary { border-top: 4px solid var(--primary-color); }
.stats-card.primary .stats-icon { background: rgba(13, 110, 253, 0.1); color: var(--primary-color); }

.stats-card.success { border-top: 4px solid var(--success-color); }
.stats-card.success .stats-icon { background: rgba(25, 135, 84, 0.1); color: var(--success-color); }

.stats-card.info { border-top: 4px solid var(--info-color); }
.stats-card.info .stats-icon { background: rgba(13, 202, 240, 0.1); color: var(--info-color); }

.stats-card.warning { border-top: 4px solid var(--warning-color); }
.stats-card.warning .stats-icon { background: rgba(255, 193, 7, 0.1); color: #b45309; }

/* ====== 图表容器 ====== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    padding: 10px;
}

/* ====== 表格样式 ====== */
.table {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.table thead th {
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-light);
    border-bottom: 2px solid var(--border-color);
    padding: 14px 16px;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.table tbody td {
    vertical-align: middle;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: #f8f9ff;
}

.table .badge {
    padding: 6px 12px;
    font-weight: 500;
    border-radius: 20px;
}

/* ====== 分页样式 ====== */
.pagination {
    margin-top: 24px;
    gap: 4px;
}

.page-link {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 16px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    color: var(--text-primary);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

/* ====== 模态框样式 ====== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
}

.modal-title {
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

/* ====== 表单样式 ====== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ====== 按钮样式 ====== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.9rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #157347 100%);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

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

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

/* ====== Toast样式 ====== */
.toast {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: none;
    min-width: 300px;
}

.toast-body {
    padding: 16px 20px;
    font-weight: 500;
}

/* ====== 管理员操作按钮 ====== */
.admin-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 8px;
}

.admin-actions .btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    opacity: 0.85;
    transition: all 0.2s ease;
}

.admin-actions .btn:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* ====== 打开方式选择弹窗 ====== */
.open-method-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.open-method-card:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.open-method-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e6f0ff 0%, #cce5ff 100%);
}

.open-method-card .icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.open-method-card .title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.open-method-card .desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ====== 分享链接区域 ====== */
.share-link-box {
    background: var(--bg-light);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.share-link-input {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
    color: var(--text-primary);
}

.copy-success {
    color: var(--success-color);
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ====== 空状态 ====== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
    color: var(--primary-color);
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0;
}

/* ====== 加载状态 ====== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(13, 110, 253, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ====== 动画效果 ====== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.slide-up {
    animation: slideUp 0.4s ease forwards;
}

/* ====== 移动端优化 ====== */
@media (max-width: 768px) {
    /* 导航栏 */
    .navbar {
        padding: 10px 0;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-nav {
        gap: 4px;
    }
    
    .navbar-nav .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    /* 主内容区域 */
    .container-fluid {
        padding: 12px;
    }
    
    /* 标签页 */
    .nav-tabs {
        padding: 6px 6px 0;
        border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    }
    
    .nav-tabs .nav-link {
        padding: 12px 16px;
        font-size: 0.9rem;
        margin-right: 2px;
    }
    
    .nav-tabs .nav-link i {
        display: block;
        margin-bottom: 4px;
    }
    
    /* 卡片 */
    .card {
        margin-bottom: 16px;
        border-radius: var(--radius-sm);
    }
    
    .card-header {
        padding: 14px 18px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .card-body {
        padding: 18px;
    }
    
    /* 文件列表 */
    .list-group-item {
        padding: 14px;
        margin-bottom: 8px;
    }
    
    .list-group-item h6 {
        font-size: 0.95rem;
    }
    
    .admin-actions {
        justify-content: flex-start;
        margin-top: 10px;
    }
    
    /* 文件预览 */
    .file-preview-container {
        min-height: 300px;
        height: calc(100vh - 250px);
    }
    
    .file-preview-container iframe {
        min-height: 300px;
        height: 100%;
    }
    
    .preview-toolbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 15px;
    }
    
    .preview-toolbar .btn-group {
        width: 100%;
        justify-content: center;
    }
    
    /* 统计卡片 */
    .stats-card {
        padding: 18px;
        margin-bottom: 12px;
    }
    
    .stats-card .stats-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .stats-card .stats-value {
        font-size: 1.6rem;
    }
    
    .stats-card .stats-label {
        font-size: 0.8rem;
    }
    
    /* 图表 */
    .chart-container {
        height: 250px;
    }
    
    /* 表格 */
    .table {
        font-size: 0.85rem;
    }
    
    .table thead th {
        padding: 12px;
        font-size: 0.75rem;
    }
    
    .table tbody td {
        padding: 12px;
    }
    
    /* 分页 */
    .pagination {
        margin-top: 20px;
    }
    
    .page-link {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    /* 模态框 */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: var(--radius-md);
    }
    
    .modal-header {
        padding: 16px 18px;
    }
    
    .modal-body {
        padding: 18px;
    }
    
    .modal-footer {
        padding: 14px 18px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* 表单 */
    .form-control, .form-select {
        padding: 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    /* 按钮 */
    .btn {
        padding: 12px 20px;
    }
    
    .btn-sm {
        padding: 10px 16px;
    }
    
    /* 打开方式选择 */
    .open-method-card {
        padding: 18px;
    }
    
    .open-method-card .icon {
        font-size: 2rem;
    }
    
    .open-method-card .title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕优化 */
    .navbar-brand span {
        display: none;
    }
    
    .navbar-brand i {
        margin-right: 0;
    }
    
    .nav-tabs .nav-link {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .nav-tabs .nav-link span.tab-text {
        display: none;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .stats-card {
        padding: 14px;
    }
    
    .stats-card .stats-value {
        font-size: 1.4rem;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
}

/* ====== 触摸优化 ====== */
@media (hover: none) {
    .btn:hover {
        transform: none;
        box-shadow: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    .list-group-item:hover {
        background-color: white;
        border-color: var(--border-color);
    }
    
    .list-group-item:active {
        background-color: #f0f7ff;
        border-color: var(--primary-color);
    }
}

/* ====== 暗色模式支持（可选） ====== */
@media (prefers-color-scheme: dark) {
    /* 可以在这里添加暗色模式样式 */
}

/* ====== 打印样式 ====== */
@media print {
    .navbar,
    .nav-tabs,
    .btn,
    .modal,
    .admin-actions,
    .preview-toolbar {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    
    .card-header {
        background-color: #f8f9fa !important;
    }
    
    body {
        background: white;
    }
}

/* ====== 滚动条样式 ====== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

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

/* ====== 代码编辑器样式 ====== */
#codeEditor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    tab-size: 2;
    min-height: 300px;
}

/* ====== 备份列表样式 ====== */
.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.backup-item:hover {
    background-color: var(--bg-light);
}

.backup-item:last-child {
    border-bottom: none;
}

.backup-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.backup-actions .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

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

/* ====== 响应式表格 ====== */
.table-responsive {
    border-radius: var(--radius-sm);
    overflow: hidden;
}

/* ====== 密码输入框组 ====== */
.password-input-group {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.password-toggle:hover {
    color: var(--primary-color);
}