/**
 * 项目管理页面样式表
 * 优化版本 - 支持IE11+兼容性
 */

/* 基础样式 */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f9fafb;
    color: #374151;
    line-height: 1.6;
}

/* 渐变背景 - 兼容性优化 */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* IE 回退 */
    background: #667eea;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#667eea', endColorstr='#764ba2', GradientType=1);
}

/* 侧边栏 */
.sidebar {
    background: white;
    border-right: 1px solid #e5e7eb;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

/* 导航项 - 优化兼容性 */
.nav-item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #4b5563;
    text-decoration: none;
    border-radius: 8px;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.nav-item.active {
    background: #ede9fe;
    color: #5b21b6;
}

/* 卡片组件 */
.card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 24px;
}

/* 表单组件 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 6px;
}

/* 表单输入框 - 修复高度问题 */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    background-color: #ffffff;
    min-height: 40px;
    line-height: 1.5;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

/* 特定输入框高度设置 */
.form-input[type="text"],
.form-input[type="email"],
.form-input[type="password"] {
    height: 40px;
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

/* 焦点状态 */
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #667eea;
    -webkit-box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

/* 按钮组件 - 优化兼容性 */
.btn {
    min-height: 40px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* IE 回退 */
    background: #667eea;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#667eea', endColorstr='#764ba2', GradientType=1);
    color: white;
    -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover:not(:disabled) {
    -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* 标签页内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Slots 相关样式 */
.slot-item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.slot-item textarea {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    min-height: 40px;
    resize: vertical;
}

.remove-btn {
    width: 32px;
    height: 32px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    margin-top: 4px;
}

.remove-btn:hover {
    background: #fecaca;
}

.slot-category {
    margin-bottom: 24px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.slot-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-bottom: 16px;
}

.slot-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #667eea;
    -webkit-animation: spin 0.8s linear infinite;
    animation: spin 0.8s linear infinite;
}

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

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

/* 文本截断 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* IE 回退 */
    max-height: 3em;
    line-height: 1.5em;
    overflow: hidden;
}

/* 特定区域样式优化 */
#edit-writing-rules {
    min-height: 120px;
    line-height: 1.6;
}

#edit-system-message {
    min-height: 80px;
    line-height: 1.6;
}

#edit-shell-template {
    min-height: 250px;
    line-height: 1.6;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

#kb-text-content {
    min-height: 400px !important;
    height: 400px !important;
    line-height: 1.6;
    font-size: 14px;
}

#prod-primary-selling-point {
    min-height: 200px !important;
    height: 200px !important;
    line-height: 1.6;
    font-size: 14px;
}

/* 滚动条美化 - 兼容性处理 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

#kb-documents-list::-webkit-scrollbar {
    width: 6px;
}

#kb-documents-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

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

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

/* 知识库文档项 */
.kb-doc-item {
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

.kb-doc-item:hover {
    -webkit-transform: translateX(2px);
    transform: translateX(2px);
}

.kb-doc-item .doc-id {
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 4px;
}

.kb-doc-item .doc-preview {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

/* 模态框动画 */
#docViewModal {
    -webkit-animation: fadeIn 0.2s ease;
    animation: fadeIn 0.2s ease;
}

#docViewModal.hidden {
    -webkit-animation: fadeOut 0.2s ease;
    animation: fadeOut 0.2s ease;
}

@-webkit-keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@-webkit-keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 移动端响应式优化 - 增加更多断点 */
@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 50;
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%);
        -webkit-transition: -webkit-transform 0.3s ease;
        transition: -webkit-transform 0.3s ease;
        transition: transform 0.3s ease;
        transition: transform 0.3s ease, -webkit-transform 0.3s ease;
    }
    
    .sidebar.open {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
    
    main {
        margin-left: 0 !important;
        padding: 1rem !important;
    }
    
    .card {
        padding: 1rem;
    }
    
    .grid-cols-2 {
        -ms-grid-columns: 1fr !important;
        grid-template-columns: 1fr !important;
    }
    
    .btn-group {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn {
        width: 100%;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
    }

    .nav-item {
        padding: 1rem;
        min-height: 48px;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        min-height: 44px;
        font-size: 16px; /* 防止iOS缩放 */
    }
}

/* 小屏幕优化 */
@media (max-width: 640px) {
    .text-2xl {
        font-size: 1.5rem;
    }
    
    .form-textarea {
        min-height: 120px;
    }
    
    .kb-upload-section {
        -ms-grid-columns: 1fr !important;
        grid-template-columns: 1fr !important;
    }
    
    .kb-doc-item {
        font-size: 0.875rem;
    }
    
    .kb-doc-item .doc-preview {
        max-height: 3rem;
        overflow: hidden;
    }

    .kb-doc-item .btn-sm {
        padding: 0.5rem;
        min-width: 40px;
        min-height: 40px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .card {
        padding: 0.75rem;
    }
    
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 16px;
        padding: 12px;
    }
    
    .btn {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .nav-item {
        font-size: 15px;
        padding: 1rem 0.75rem;
    }
}

/* IE 特定样式修复 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    /* IE 10+ */
    .flex {
        display: -ms-flexbox !important;
        display: flex !important;
    }
    
    .justify-center {
        -ms-flex-pack: center;
        justify-content: center;
    }
    
    .items-center {
        -ms-flex-align: center;
        align-items: center;
    }
    
    .flex-1 {
        -ms-flex: 1;
        flex: 1;
    }
}

/* 打印样式优化 */
@media print {
    .sidebar,
    .mobile-menu-btn,
    .btn {
        display: none !important;
    }
    
    main {
        margin-left: 0 !important;
    }
    
    .card {
        -webkit-box-shadow: none !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
} 