/* styles/style.css - 主样式文件（本地化版本） */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: #f9fafb;
    margin: 0;
    padding: 0;
}

/* 导航栏样式 */
.navbar {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 0.75rem 0;
    background-color: var(--primary-color) !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    color: white !important;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
}

.navbar-nav .nav-link:hover {
    color: white !important;
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

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

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

.card-body {
    padding: 1.25rem;
}

/* 按钮样式 */
.btn {
    font-weight: 500;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

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

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

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

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

/* 表单样式 */
.form-control {
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-select {
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
}

/* 警告框样式 */
.alert {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border: none;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* 下拉菜单样式 */
.dropdown-menu {
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    font-size: 0.875rem;
    padding: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f1f5f9;
}

/* 功能图标样式 */
.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* 文本样式 */
.display-4 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.lead {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.text-muted {
    color: var(--text-secondary) !important;
}

/* Markdown预览样式 */
.markdown-preview {
    background-color: var(--secondary-color);
    border-radius: 0.5rem;
    padding: 1rem;
    min-height: 300px;
    font-size: 0.875rem;
    line-height: 1.6;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-preview p {
    margin-bottom: 1rem;
}

.markdown-preview code {
    background-color: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 页脚样式 */
footer {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
}

/* 编辑器样式 */
.editor-container {
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.editor-container .CodeMirror {
    height: 500px;
    font-family: 'Inter', monospace;
    font-size: 0.875rem;
    padding: 1rem;
}

.editor-toolbar {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem;
    background-color: #f8fafc;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* 文档卡片样式 */
.document-card {
    transition: all 0.3s ease;
}

.document-item {
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    height: 100%;
}

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

.document-status .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* 徽章样式 */
.badge {
    font-size: 0.75em;
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-secondary {
    background-color: var(--text-secondary) !important;
}

/* 二维码样式 */
.qr-code-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
}

#qrcode {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 3px solid white;
}

/* 模态框样式 */
.modal-content {
    border-radius: 0.75rem;
    border: none;
    box-shadow: var(--card-hover-shadow);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

/* 工具提示样式 */
.tooltip-btn {
    position: relative;
}

.tooltip-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tooltip-btn:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 10px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .display-4 {
        font-size: 1.75rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .sidebar {
        margin-bottom: 1.5rem;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .action-buttons .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .document-card {
        margin-bottom: 1rem;
    }
    
    .qr-code-container {
        margin-top: 20px;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
}

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

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

.document-card {
    animation: fadeIn 0.5s ease forwards;
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* 实用工具类 */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.d-none {
    display: none !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.p-0 {
    padding: 0 !important;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

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

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

/* 紧凑模态框样式 */
.compact-modal .modal-dialog {
    max-width: 400px;
}

.compact-modal .modal-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.compact-modal .modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.compact-modal .modal-body {
    padding: 1rem;
}

.compact-modal .modal-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
}

/* 小尺寸输入组 */
.input-group-sm .form-control {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

.input-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* 分享状态卡片 */
.share-status-card {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-top: 1rem;
}

.share-status-card .fa-check-circle {
    font-size: 1.25rem;
}

/* 响应式调整 */
@media (max-width: 576px) {
    .compact-modal .modal-dialog {
        margin: 0.5rem;
    }
    
    .share-status-card {
        flex-direction: column;
        text-align: center;
    }
    
    .share-status-card i {
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
}

/* 响应式操作菜单 */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    white-space: nowrap;
}

/* 移动端适配 */
@media (max-width: 767.98px) {
    .action-buttons {
        justify-content: center;
        width: 100%;
    }
    
    .action-buttons .btn {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
    
    .action-buttons .btn-group {
        width: 100%;
    }
    
    .action-buttons .btn-group .btn {
        flex: 1;
    }
    
    /* 卡片头部适配 */
    .card-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .card-header .form-check-switch {
        align-self: flex-start;
    }
}

/* 加密相关样式 */
#encryptionFields {
    background-color: #f8f9fa;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
}

/* 版本历史表格 */
.version-table {
    font-size: 0.875rem;
}

.version-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* 紧凑模态框 */
.compact-modal .modal-dialog {
    max-width: 400px;
}

.compact-modal .modal-header {
    padding: 0.75rem 1rem;
}

.compact-modal .modal-body {
    padding: 1rem;
}

.compact-modal .modal-footer {
    padding: 0.75rem 1rem;
}

/* 表单切换动画 */
.form-check-switch {
    transition: all 0.3s ease;
}

/* 加密警告样式 */
.encryption-warning {
    border-left: 4px solid #ffc107;
    background-color: #fff8e1;
}

/* 版本历史预览 */
.version-preview {
    max-height: 400px;
    overflow-y: auto;
}

/* 移动端表格响应式 */
@media (max-width: 575.98px) {
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table-responsive .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* 文档状态标签 */
.document-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* 加密文档样式 */
.encrypted-document {
    position: relative;
}

.encrypted-document::before {
    content: '🔒';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    z-index: 10;
}

/* 版本预览样式 */
.version-preview-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: #6c757d;
}

.version-preview-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 0.5rem;
    padding: 1rem;
    color: #721c24;
}

/* 比较视图样式 */
.version-compare-view {
    height: 70vh;
    overflow-y: auto;
}

.version-compare-view .markdown-preview {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
}

/* 差异高亮样式 */
.diff-added {
    background-color: #d4edda;
    text-decoration: underline;
}

.diff-removed {
    background-color: #f8d7da;
    text-decoration: line-through;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .version-compare-view {
        height: 50vh;
    }
    
    #versionCompareModal .modal-dialog {
        margin: 0.5rem;
    }
}