/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    color: #333;
}

/* 通用类 */
.hidden {
    display: none !important;
}

/* 登录提示样式 */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-container.show {
    opacity: 1;
    visibility: visible;
}

/* 确保协议模态框正确显示 */
#agreement-modal {
    display: flex !important;
    opacity: 0;
    visibility: hidden;
}

#agreement-modal.show {
    opacity: 1;
    visibility: visible;
}

/* 模态框内容 */
.modal-content {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.login-container.show .modal-content {
    transform: translateY(0);
}

/* 登录模态框 */
.login-modal-content h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.login-modal-content p {
    text-align: center;
    margin-bottom: 30px;
    color: #666;
    font-size: 14px;
}

/* 协议模态框 */
.agreement-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.agreement-modal-content h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

/* 关闭按钮 */
.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
    z-index: 1001;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.modal-close-btn:hover {
    color: #333;
}

/* 表单组 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

/* 忘记密码链接 */
.forgot-password-link {
    display: inline-block;
    margin-top: 8px;
    margin-bottom: 10px;
    float: right;
    color: #f44336;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.3s ease;
}

.forgot-password-link:hover {
    color: #d32f2f;
    text-decoration: underline;
}

/* 验证码容器 */
.verify-code-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.verify-code-container input {
    flex: 2;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.send-code-btn {
    flex: 1;
    padding: 0 15px;
    height: 44px;
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-code-btn:hover {
    background-color: #e0e0e0;
}

/* 用户协议容器 */
.agreement-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agreement-container input {
    width: auto;
}

.agreement-container span {
    font-weight: normal;
    font-size: 14px;
    color: #555;
}

.agreement-container a {
    color: #4CAF50;
    text-decoration: none;
}

.agreement-container a:hover {
    text-decoration: underline;
}

/* 操作按钮 */
.action-buttons {
    margin-top: 20px;
}

.action-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn {
    background-color: #4CAF50;
    color: white;
}

.login-btn:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.register-btn {
    background-color: #4CAF50;
    color: white;
}

.register-btn:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.reset-password-btn {
    background-color: #4CAF50;
    color: white;
}

.reset-password-btn:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.agree-btn {
    background-color: #4CAF50;
    color: white;
    margin-top: 20px;
}

.agree-btn:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* 协议内容 */
.agreement-content {
    margin-bottom: 20px;
}

.agreement-section {
    margin-bottom: 15px;
}

.agreement-section h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
}

.agreement-section p {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    text-indent: 2em; /* 段落开头缩进两格 */
}

.agreement-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 15px 0;
    width: 100%;
}

/* 主应用界面样式 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #333;
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

#logout-btn {
    background-color: #f44336;
    color: white;
}

#manage-btn {
    background-color: #2196F3;
    color: white;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 右侧工具栏 */
.right-toolbar {
    width: 260px;
    background-color: #f5f5f5;
    padding: 10px;
    border-left: 1px solid #ddd;
    overflow-x: hidden;
    overflow-y: auto;
    user-select: none;
}

.right-toolbar .tool-group {
    margin-bottom: 15px;
}

.right-toolbar .tool-group h3 {
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.alignment-buttons,
.allignment-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.allignment-buttons {
    grid-template-columns: 1fr;
}

.right-toolbar button {
    width: 100%;
    padding: 6px;
    margin-bottom: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s;
}

.right-toolbar button:hover {
    background-color: #f0f0f0;
}

/* 工具栏样式 */
.toolbar {
    width: 260px;
    background-color: #f5f5f5;
    padding: 10px;
    border-right: 1px solid #ddd;
    overflow-x: hidden;
    overflow-y: auto;
    user-select: none;
}

.tool-group {
    margin-bottom: 15px;
}

.tool-group h3 {
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.tool-group input[type="file"] {
    margin-bottom: 6px;
}

.tool-group button {
    width: 100%;
    padding: 6px;
    margin-bottom: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s;
}

.tool-group button:hover {
    background-color: #f0f0f0;
}

.tool-group select {
    width: 100%;
    padding: 6px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.canvas-size-group {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.canvas-size-group label {
    display: inline-block;
    margin-bottom: 0;
    font-size: 13px;
    flex: 1;
}

.canvas-size-group input {
    width: 80px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    flex: none;
}

.margin-group {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.margin-group label {
    display: inline-block;
    margin-bottom: 0;
    font-size: 13px;
    flex: 1;
}

.margin-group input {
    width: 80px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    flex: none;
}

.slider-group {
    margin-bottom: 8px;
}

.slider-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.slider-group input[type="range"] {
    width: 100%;
}

.text-direction {
    margin-bottom: 8px;
}

.text-direction label {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
}

.text-direction select {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin-bottom: 15px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* 画布容器样式 */
.canvas-container {
    flex: 1;
    position: relative;
    background-color: #666666;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: 10px; /* 将顶部内边距调为10px */
    padding-bottom: 10px; /* 将底部内边距调为10px */
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
}

#canvas {
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    display: block;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.canvas-grid {
    position: absolute;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

/* 移动端工具栏样式 */
.mobile-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #333;
    color: white;
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-tool-group {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-tool-group button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    background-color: #2196F3;
    color: white;
    cursor: pointer;
}

.mobile-tool-group input[type="file"] {
    color: white;
}

/* 管理中心界面样式 */
.manage-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: white;
}

.manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #333;
    color: white;
}

#back-to-editor {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #2196F3;
    color: white;
    cursor: pointer;
}

.projects-list {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
}

.project-info h3 {
    margin-bottom: 5px;
}

.project-info p {
    font-size: 14px;
    color: #666;
}

.project-actions {
    display: flex;
    gap: 10px;
}

.project-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.open-project {
    background-color: #4CAF50;
    color: white;
}

.delete-project {
    background-color: #f44336;
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .toolbar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #ddd;
        padding: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
    }

    .tool-group {
        display: inline-block;
        margin-right: 20px;
        margin-bottom: 0;
        vertical-align: top;
    }

    .canvas-container {
        flex: 1;
    }

    .mobile-toolbar {
        display: block;
    }

    .header h1 {
        font-size: 18px;
    }

    .user-info {
        font-size: 14px;
    }
}

@media (min-width: 769px) {
    .mobile-toolbar {
        display: none;
    }
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 500px;
    position: relative;
}

.modal-content h3 {
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.text-input {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 18px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.modal-buttons {
    display: flex;
    justify-content: space-between;
}

.modal-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#text-input-confirm {
    background-color: #4CAF50;
    color: white;
}

#text-input-confirm:hover {
    background-color: #45a049;
}

#text-input-cancel {
    background-color: #f44336;
    color: white;
}

#text-input-cancel:hover {
    background-color: #da190b;
}

/* 人机验证样式 */
.verify-question {
    margin-bottom: 20px;
}

.verify-question p {
    margin-bottom: 10px;
    text-align: center;
    font-size: 16px;
    color: #333;
}

.verify-question input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
}

.verify-question input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

/* 加载 spinner */
.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #4CAF50;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}