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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 15px;
}

.container {
    width: 100%;
    max-width: none;
    margin: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-height: calc(100vh - 30px);
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

header h1 .version {
    font-size: 14px;
    font-weight: normal;
    opacity: 0.8;
    margin-left: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 12px;
}

nav a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    padding: 8px 16px;
    border-radius: 5px;
    transition: background 0.3s;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.2);
}

nav a.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

nav {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

nav button {
    margin-left: 20px;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-link {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    padding: 8px 16px;
    border-radius: 5px;
    transition: background 0.3s;
    background: rgba(255, 255, 255, 0.2);
}

.btn-link:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.user-info #username {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.3);
    font-weight: 500;
    font-size: 12px;
    margin-right: 15px;
    white-space: nowrap;
}

.user-info .btn-link {
    margin-left: 0;
}

.config-import {
    display: flex;
    gap: 10px;
    align-items: center;
}

.config-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.config-modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: left;
    min-width: 600px;
    max-width: 800px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.config-modal-content h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #333;
    text-align: center;
}

.config-modal-section {
    margin-bottom: 20px;
}

.config-modal-section label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section input,
.modal-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}

.modal-section input:focus,
.modal-section textarea:focus {
    outline: none;
    border-color: #667eea;
}

.modal-section textarea {
    min-height: 150px;
    resize: vertical;
}

.saved-configs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    background: #f8f9fa;
}

.saved-configs-filter {
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.saved-config-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 200px;
}

.saved-config-item:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.saved-config-item.selected {
    background: #e8f4fd;
    border-color: #667eea;
}

.saved-config-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.saved-config-name {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.saved-config-time {
    font-size: 11px;
    color: #999;
}

.saved-config-username {
    font-size: 11px;
    color: #667eea;
}

.saved-config-actions {
    display: flex;
    gap: 5px;
}

.saved-config-btn {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.saved-config-delete {
    background: #e74c3c;
    color: white;
}

.saved-config-delete:hover {
    background: #c0392b;
}

.config-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.config-modal-actions .btn {
    min-width: 100px;
}

main {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
    font-size: 24px;
    color: #333;
}

.merge-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover {
    background: #27ae60;
}

.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.category-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    transition: all 0.3s;
}

.category-card:hover {
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.category-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
    position: relative;
}

.category-file-types {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.category-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.logo-text {
    color: #667eea;
    font-size: 16px;
    font-weight: bold;
    display: none;
}

.category-card h3 {
    font-size: 15px;
    color: #333;
    margin: 0;
    flex: 1;
    line-height: 1.4;
}

.file-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.selected-file {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-selector-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.preview-file-btn {
    padding: 6px 12px;
    background: #b8c5d6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.preview-file-btn:hover:not(:disabled) {
    background: #a8b5c6;
    transform: translateY(-1px);
}

.preview-file-btn:disabled {
    background: #d0d0d0;
    cursor: not-allowed;
    opacity: 0.6;
}

.change-file-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.change-file-btn:hover {
    background: #5568d3;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height:205px;
    overflow-y: auto;
    padding-right: 5px;
}

.file-list::-webkit-scrollbar {
    width: 6px;
}

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

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

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

.file-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    transition: all 0.3s;
    cursor: pointer;
}

.file-item:hover {
    background: #f0f4ff;
    border-color: #667eea;
}

.file-item.selected {
    background: #e8f4fd;
    border-color: #667eea;
}

.file-checkbox {
    margin-right: 10px;
    cursor: pointer;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 3px;
    word-break: break-all;
}

.file-meta {
    font-size: 12px;
    color: #999;
}

.file-actions {
    display: flex;
    gap: 8px;
    margin-left: 10px;
}

.preview-btn {
    padding: 4px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.preview-btn:hover {
    background: #218838;
    transform: scale(1.05);
}

.download-btn {
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: auto;
}

.download-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.file-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 5px;
}

.file-type.pdf {
    background: #ffeaa7;
    color: #d35400;
}

.file-type.dwg {
    background: #74b9ff;
    color: #0984e3;
}

.selected-files-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #667eea;
}

.selected-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.selected-file-item {
    background: white;
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.selected-file-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.selected-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-file-name {
    font-size: 14px;
    color: #333;
}

.remove-selected-btn {
    background: #ff4757;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.remove-selected-btn:hover {
    background: #ff3838;
    transform: scale(1.1);
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 16px;
}

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 40px;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    min-width: 300px;
}

.download-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    min-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.download-content h3 {
    margin: 0 0 25px 0;
    font-size: 20px;
    color: #333;
}

.download-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.download-option {
    padding: 12px 30px;
    font-size: 14px;
    min-width: 120px;
}

.pdf-preview-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    height: 85vh;
    max-width: 1400px;
    max-height: none;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.pdf-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #e9ecef;
}

.pdf-preview-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.pdf-preview-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.pdf-preview-body iframe {
    width: 100%;
    height: 100%;
    min-height: 600px;
    border: none;
}

.file-selection-content {
    width: 90%;
    max-width: 600px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.file-selection-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px;
}

.file-selection-item {
    margin-bottom: 10px;
    padding: 0;
    border-radius: 4px;
    transition: background 0.2s;
}

.file-selection-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    padding: 10px;
    border-radius: 4px;
    transition: background 0.2s;
    width: 100%;
}

.file-selection-label:hover {
    background: #f8f9fa;
}

.file-selection-item input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
    width: 20px;
    height: 20px;
}

.file-selection-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.file-selection-name {
    flex: 1;
}

.file-selection-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-close {
    padding: 8px 20px;
    background: #95a5a6;
    color: white;
    font-size: 13px;
}

.btn-close-large {
    width: 40px;
    height: 40px;
    padding: 0;
    background: #95a5a6;
    color: white;
    font-size: 24px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.btn-close-large:hover {
    background: #7f8c8d;
}

.btn-close:hover {
    background: #7f8c8d;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-content p {
    color: #333;
    font-size: 16px;
    margin: 0;
}

.no-files {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 8px;
    }

    header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 20px;
    }

    header h1 {
        font-size: 20px;
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    nav a, nav button {
        margin: 5px;
        font-size: 12px;
        padding: 6px 12px;
    }

    .user-info {
        margin: 5px;
    }

    .user-info #username {
        min-width: 32px;
        height: 32px;
        font-size: 11px;
        padding: 0 10px;
        border-radius: 16px;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .section-header h2 {
        font-size: 18px;
        text-align: center;
    }

    .merge-actions {
        flex-direction: column;
    }

    .merge-actions button {
        width: 100%;
    }

    .category-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .category-card {
        padding: 10px;
    }

    .category-card-header h3 {
        font-size: 14px;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .file-checkbox {
        width: 20px;
        height: 20px;
    }

    .file-info {
        width: 100%;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
    }

    .preview-btn, .download-btn {
        flex: 1;
        padding: 8px 15px;
    }

    .selected-files-list {
        flex-direction: column;
    }

    .selected-file-item {
        flex-direction: row;
        justify-content: space-between;
    }

    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    .pdf-preview-content {
        width: 95%;
        height: 80vh;
    }

    .pdf-preview-body iframe {
        min-height: 400px;
    }

    .config-modal-content {
        max-height: 80vh;
        overflow-y: auto;
    }

    .config-modal-section label {
        font-size: 14px;
    }
}

/* Footer 样式 */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    text-align: center;
    border-top: none;
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
    font-weight: 500;
}

.footer-links a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.footer-separator {
    margin: 0 15px;
    color: rgba(255, 255, 255, 0.5);
}

.copyright {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}
