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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 头部样式 */
.header {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: #0052D9;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    letter-spacing: 2px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #0052D9 0%, #0078D7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.header-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* 版本信息样式 */
.version-info {
    font-size: 13px;
    color: #999;
    font-weight: 400;
    font-family: 'Courier New', Courier, monospace;
}

.lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    padding: 5px 10px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px 10px;
    color: #666;
}

.icon-btn:hover, .lang-btn:hover {
    color: #1a73e8;
}

/* 主内容区域 */
.main-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 40px;
}

.page-title {
    text-align: center;
    font-size: 32px;
    color: #1a73e8;
    margin-bottom: 40px;
    font-weight: 600;
}

/* 区块样式 */
.create-section, .list-section, .builtin-section {
    background: #fff;
    border-radius: 8px;
    padding: 40px 60px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.section-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #1a73e8;
    font-weight: 500;
}

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

/* 表单样式 */
.project-form {
    max-width: 900px;
    margin: 0 auto;
}

.form-row {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.form-group {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 800px;
}

.form-group label {
    width: 120px;
    min-width: 120px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
    text-align: right;
    margin-right: 15px;
}

.form-group label.required::before {
    content: "*";
    color: #e53935;
    margin-right: 4px;
}

.form-group input,
.form-group select {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fafafa;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1a73e8;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

.form-group input::placeholder {
    color: #999;
}

.form-actions {
    margin-top: 30px;
    text-align: center;
}

/* 按钮样式 */
.btn {
    padding: 10px 30px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background-color: #1a73e8;
    color: #fff;
}

.btn-primary:hover {
    background-color: #1557b0;
    box-shadow: 0 2px 8px rgba(26,115,232,0.3);
}

.btn-icon {
    background-color: #1a73e8;
    color: #fff;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon:hover {
    background-color: #1557b0;
}

.refresh-icon {
    font-size: 18px;
}

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

/* 表格样式 */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.project-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.project-table thead {
    background-color: #f8f9fa;
}

.project-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
    font-size: 14px;
}

.project-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    color: #666;
}

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

.project-table tbody tr:last-child td {
    border-bottom: none;
}

/* 操作按钮 */
.action-btn {
    padding: 5px 15px;
    margin-right: 8px;
    border: 1px solid #1a73e8;
    background: #fff;
    color: #1a73e8;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.action-btn:hover {
    background-color: #1a73e8;
    color: #fff;
}

.action-btn.delete {
    border-color: #e53935;
    color: #e53935;
}

.action-btn.delete:hover {
    background-color: #e53935;
    color: #fff;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state-text {
    font-size: 16px;
    color: #666;
    font-weight: 500;
    margin-bottom: 10px;
}

.empty-state-hint {
    font-size: 14px;
    color: #999;
    line-height: 1.6;
}

/* 消息提示 */
.message {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
}

.message.success {
    background-color: #4caf50;
    color: #fff;
}

.message.error {
    background-color: #e53935;
    color: #fff;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        padding: 0 20px;
    }

    .create-section, .list-section {
        padding: 30px 20px;
    }

    .form-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-group label {
        width: 100%;
        text-align: left;
        margin-bottom: 8px;
        margin-right: 0;
    }

    .form-group input,
    .form-group select {
        max-width: 100%;
    }

    .form-actions {
        text-align: center;
    }

    .table-container {
        font-size: 12px;
    }

    .project-table th,
    .project-table td {
        padding: 10px 8px;
    }
}

/* 加载状态样式 */
.loading-state {
    text-align: center;
    padding: 60px 20px !important;
    background-color: #fafafa;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0052D9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.loading-text {
    color: #666;
    font-size: 14px;
    margin-top: 12px;
}

/* 空状态样式优化 */
.empty-state {
    text-align: center;
    padding: 60px 20px !important;
    background-color: #fafafa;
}

.empty-state-text {
    font-size: 16px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.empty-state-hint {
    font-size: 14px;
    color: #999;
}

/* 内置项目模板样式 */
.template-name-with-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.template-badge {
    background: linear-gradient(135deg, #1a73e8 0%, #0052D9 100%);
    color: #fff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    display: inline-block;
}

/* 模板图片预览 */
.template-image-cell {
    width: 120px;
    padding: 8px !important;
    text-align: center;
    vertical-align: middle;
}

.template-preview-image {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s;
}

.template-preview-image:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-color: #1a73e8;
}

.no-image-placeholder {
    width: 100px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    border: 1px dashed #d0d0d0;
    border-radius: 4px;
    font-size: 12px;
    color: #999;
    margin: 0 auto;
}

/* 图片放大模态框 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    cursor: default;
    animation: zoom 0.3s;
}

@keyframes zoom {
    from {transform: scale(0.8); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: #bbb;
}

.image-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 20px 0;
    font-size: 16px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .template-image-cell {
        width: 80px;
    }

    .template-preview-image,
    .no-image-placeholder {
        width: 70px;
        height: 50px;
    }

    .modal-content {
        max-width: 95%;
        max-height: 70%;
    }

    .close-modal {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
}

/* 创建项目对话框样式 */
.create-project-dialog {
    border: none;
    border-radius: 12px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: dialogFadeIn 0.3s ease-out;
    /* 居中定位 */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.create-project-dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: backdropFadeIn 0.3s ease-out;
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0) scale(1);
    }
}

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

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #fafafa;
    border-radius: 12px 12px 0 0;
    cursor: move;
    user-select: none;
}

.dialog-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.dialog-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.dialog-close:hover {
    background-color: #f0f0f0;
    color: #666;
}

.dialog-content {
    padding: 30px;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.btn-secondary {
    background-color: #fff;
    color: #666;
    border: 1px solid #d0d0d0;
}

.btn-secondary:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

/* 对话框内的表单样式调整 */
.create-project-dialog .project-form {
    max-width: 100%;
}

.create-project-dialog .form-row {
    margin-bottom: 20px;
}

.create-project-dialog .form-group {
    max-width: 100%;
}

/* 响应式调整 - 对话框 */
@media (max-width: 768px) {
    .create-project-dialog {
        width: 95%;
        max-width: 95%;
    }

    .dialog-header {
        padding: 20px;
    }

    .dialog-content {
        padding: 20px;
    }

    .dialog-title {
        font-size: 18px;
    }

    .create-project-dialog .form-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .create-project-dialog .form-group label {
        width: 100%;
        text-align: left;
        margin-bottom: 8px;
        margin-right: 0;
    }

    .dialog-actions {
        flex-direction: column-reverse;
    }

    .dialog-actions .btn {
        width: 100%;
    }
}
