/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 头部 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* 主内容 */
main {
    padding: 40px;
}

/* 卡片布局 */
.module-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.card-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.card h2 {
    color: #333;
    margin-bottom: 10px;
}

.card p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.card ul {
    list-style: none;
    margin-bottom: 20px;
}

.card ul li {
    padding: 8px 0;
    color: #555;
    padding-left: 20px;
    position: relative;
}

.card ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* 按钮 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

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

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: scale(1.05);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.9em;
}

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

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

/* 信息部分 */
.info-section {
    background: #f7fafc;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.info-section h3 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.features {
    display: grid;
    gap: 15px;
}

.feature-item {
    display: flex;
    align-items: start;
    gap: 15px;
}

.feature-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.feature-item strong {
    display: block;
    color: #2d3748;
    margin-bottom: 5px;
}

.feature-item p {
    color: #4a5568;
    font-size: 0.95em;
    line-height: 1.5;
}

/* 最近项目 */
.recent-projects {
    margin-top: 30px;
}

.recent-projects h3 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.projects-list {
    display: grid;
    gap: 15px;
}

.project-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.project-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.project-info strong {
    display: block;
    color: #2d3748;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.project-date {
    color: #718096;
    font-size: 0.9em;
}

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

/* 页脚 */
footer {
    background: #f7fafc;
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 0.9em;
}

/* 工具提示 */
.loading,
.no-data,
.error {
    text-align: center;
    padding: 40px;
    color: #718096;
}

.error {
    color: #e53e3e;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 10px;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    main {
        padding: 20px;
    }

    .module-cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .card {
        padding: 20px;
    }

    .project-item {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .project-actions {
        justify-content: stretch;
    }

    .project-actions button {
        flex: 1;
    }
}

/* PDF查看器样式 */
.pdf-viewer {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: #f7fafc;
    min-height: 600px;
    position: relative;
    overflow: auto;
}

.pdf-canvas-container {
    position: relative;
    display: inline-block;
}

.pdf-page {
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: white;
}

/* 签章元素 */
.signature-element {
    position: absolute;
    border: 2px dashed transparent;
    cursor: move;
    transition: border-color 0.2s;
}

.signature-element:hover,
.signature-element.selected {
    border-color: #667eea;
}

.signature-element img {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 工具栏 */
.toolbar {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 输入框 */
input[type="text"],
input[type="number"],
input[type="file"],
select {
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
}

input[type="file"] {
    padding: 8px;
}

/* 签章库 */
.signature-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.signature-library-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.signature-library-toolbar input {
    flex: 1;
}

.signature-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.signature-item-preview {
    display: flex;
    align-items: center;
    justify-content: center;
}

.signature-item:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.signature-item.selected {
    border-color: #667eea;
    background: #eef2ff;
}

.signature-item img {
    max-width: 100%;
    height: 80px;
    object-fit: contain;
    margin-bottom: 0;
}

.signature-item-name {
    font-size: 0.85em;
    color: #4a5568;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.signature-item-meta {
    font-size: 0.75em;
    color: #718096;
}

.signature-item-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Canvas绘图区 */
.canvas-drawing-area {
    border: 2px solid #667eea;
    border-radius: 10px;
    cursor: crosshair;
    touch-action: none;
    background: white;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: #2d3748;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #718096;
}

.close-btn:hover {
    color: #2d3748;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2d3748;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
}

/* 通知 */
.notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    animation: slideDown 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

.notification.success {
    background: #f0fdf4;
    border-bottom: 3px solid #48bb78;
    color: #166534;
}

.notification.error {
    background: #fef2f2;
    border-bottom: 3px solid #f56565;
    color: #991b1b;
}

.notification.info {
    background: #eff6ff;
    border-bottom: 3px solid #4299e1;
    color: #1e40af;
}
