/* 属性面板样式 */
.properties-panel {
    padding: 16px;
    background: #ecf0f1;
    height: 100%;
    overflow-y: auto;
    font-size: 13px;
}

/* ===== 统一模态框样式 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-dialog {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 520px;
    width: 92%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ai-generate-dialog {
    max-width: 640px;
}

.help-dialog {
    max-width: 720px;
}

.help-dialog .modal-content {
    flex: 1;
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    letter-spacing: -0.2px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #adb5bd;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.15s;
}

.modal-close:hover {
    background: #f1f3f5;
    color: #495057;
}

.modal-content {
    padding: 20px 24px;
    overflow-y: auto;
}

.modal-footer {
    padding: 12px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    background: #fafbfc;
    flex-shrink: 0;
}

/* 模态框内表单通用 */
.modal-content label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 6px;
}

.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="number"]:focus,
.modal-content select:focus {
    outline: none;
    border-color: #4dabf7;
    box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.15);
}

.modal-content input[type="color"] {
    width: 40px;
    height: 36px;
    padding: 2px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}

.modal-content input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

.modal-content input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #4dabf7;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.modal-content input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4dabf7;
    cursor: pointer;
    margin: 0;
}

.modal-content .option-group {
    margin-bottom: 16px;
}

.modal-content .option-group:last-child {
    margin-bottom: 0;
}

.ai-generate-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.input-group textarea {
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

.input-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.generate-options {
    display: flex;
    gap: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-group label {
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-group input[type="checkbox"] {
    margin: 0;
}

.generation-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    color: #1565c0;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #bbdefb;
    border-top: 2px solid #1565c0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.generation-result {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.generation-result h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #2c3e50;
}

.preview-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.svg-preview {
    padding: 20px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
}

.svg-preview svg {
    max-width: 100%;
    max-height: 300px;
    height: auto;
}

.svg-code {
    margin-top: 12px;
}

.svg-code details {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
}

.svg-code summary {
    cursor: pointer;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.svg-code pre {
    margin: 8px 0 0 0;
    padding: 12px;
    background: #2c3e50;
    color: #ecf0f1;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.4;
}

.btn {
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
    line-height: 1.4;
    white-space: nowrap;
}

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

.btn-primary {
    background: #4dabf7;
    border-color: #4dabf7;
    color: white;
    box-shadow: 0 1px 3px rgba(77, 171, 247, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: #339af0;
    border-color: #339af0;
    box-shadow: 0 2px 6px rgba(77, 171, 247, 0.4);
}

.btn-secondary {
    background: #fff;
    border-color: #dee2e6;
    color: #495057;
}

.btn-secondary:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #ced4da;
}

.btn-success {
    background: #51cf66;
    border-color: #51cf66;
    color: white;
    box-shadow: 0 1px 3px rgba(81, 207, 102, 0.3);
}

.btn-success:hover:not(:disabled) {
    background: #40c057;
    border-color: #40c057;
}

.btn-danger {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: white;
    box-shadow: 0 1px 3px rgba(255, 107, 107, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: #fa5252;
    border-color: #fa5252;
}

.panel-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #bdc3c7;
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 属性分组 */
.property-section {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.property-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* 属性组 */
.property-group {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f4;
}

.property-group:last-child {
    border-bottom: none;
}

.property-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
    text-transform: capitalize;
}

/* 属性行 */
.property-row {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f4;
}

.property-row:last-child {
    border-bottom: none;
}

.property-row .property-group {
    flex: 1;
    padding: 0;
    border-bottom: none;
    margin-bottom: 0;
}

/* 输入框样式 */
.property-group input[type="text"],
.property-group input[type="number"],
.property-group input[type="color"],
.property-group select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    transition: all 0.15s ease;
}

.property-group input[type="text"]:focus,
.property-group input[type="number"]:focus,
.property-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.property-group input[type="color"] {
    padding: 2px;
    height: 32px;
    cursor: pointer;
}

.property-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #dee2e6;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.property-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.15s ease;
}

.property-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.property-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 颜色输入组合 */
.color-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.color-input-group input[type="color"] {
    width: 40px;
    flex-shrink: 0;
}

.color-input-group input[type="text"] {
    flex: 1;
    min-width: 80px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    font-size: 12px !important;
    margin: 6px 0 0 0 !important;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto !important;
    margin: 0;
}

/* 选择框样式 */
.property-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
    padding-right: 32px;
    appearance: none;
}

/* 字体样式按钮 */
.style-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ced4da;
    background: white;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.15s ease;
}

.style-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.style-btn.active {
    background: #3498db;
    border-color: #2980b9;
    color: white;
}

.style-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

/* 范围值显示 */
#opacity-value {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

/* 空状态 */
.property-section[data-empty="true"] {
    opacity: 0.6;
    pointer-events: none;
}

.property-section[data-empty="true"]::after {
    content: "请选择元素";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #999;
    text-align: center;
}

/* 导出选项样式 */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 400px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-group label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.option-group input,
.option-group select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
}

#quality-value {
    font-size: 12px;
    color: #666;
    margin-left: 8px;
}


/* 加载状态 */
.property-section.loading {
    position: relative;
    pointer-events: none;
}

.property-section.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1;
}

.property-section.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3498db;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    z-index: 2;
}

/* 错误状态 */
.property-group.error input,
.property-group.error select {
    border-color: #e74c3c;
    background-color: #fdf2f2;
}

.property-group.error label {
    color: #e74c3c;
}

/* 提示文本 */
.property-hint {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    line-height: 1.3;
}

/* ===== 各对话框专属优化 ===== */

/* 画布尺寸对话框 */
.canvas-size-dialog { max-width: 480px; }
.canvas-size-dialog .current-size-info {
    padding: 10px 14px;
    background: #f1f3f5;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #495057;
}
.canvas-size-dialog .current-size-info p { margin: 0; }
.canvas-size-dialog .size-input-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.canvas-size-dialog .size-input label {
    font-size: 12px;
    font-weight: 500;
    color: #868e96;
    margin-bottom: 4px;
}
.canvas-size-dialog .preset-sizes h4 {
    font-size: 12px;
    font-weight: 600;
    color: #868e96;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0 0 8px;
}
.canvas-size-dialog .preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.canvas-size-dialog .preset-btn {
    padding: 7px 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    color: #495057;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.12s;
    text-align: center;
}
.canvas-size-dialog .preset-btn:hover {
    background: #e7f5ff;
    border-color: #4dabf7;
    color: #1971c2;
}
.canvas-size-dialog .aspect-ratio-group {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #495057;
}
.canvas-size-dialog .aspect-ratio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin: 0;
}

/* 画布背景对话框 */
.canvas-background-dialog { max-width: 420px; }
.canvas-background-dialog .color-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.canvas-background-dialog .color-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}
.canvas-background-dialog .color-input-wrapper input[type="text"] {
    flex: 1;
}
.canvas-background-dialog .preset-colors h4 {
    font-size: 12px;
    font-weight: 600;
    color: #868e96;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0 0 8px;
}
.canvas-background-dialog .color-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.canvas-background-dialog .color-preset {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
    padding: 0;
}
.canvas-background-dialog .color-preset:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.canvas-background-dialog .transparency-option {
    margin-top: 14px;
}
.canvas-background-dialog .transparency-option label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    margin: 0;
}

/* 导出对话框 */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 380px;
}

/* 画布缩放确认对话框 */
.canvas-resize-dialog { max-width: 460px; }
.canvas-resize-dialog .resize-info {
    padding: 12px 14px;
    background: #fff9db;
    border: 1px solid #ffd43b;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #495057;
}
.canvas-resize-dialog .resize-info p { margin: 4px 0; }
.canvas-resize-dialog .resize-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.canvas-resize-dialog .resize-options .option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
}
.canvas-resize-dialog .resize-options .option:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}
.canvas-resize-dialog .resize-options .option label {
    cursor: pointer;
    margin: 0;
    line-height: 1.5;
}
.canvas-resize-dialog .resize-options .option label small {
    color: #868e96;
    font-size: 12px;
}

/* 保存确认对话框 */
.save-confirm-dialog { max-width: 440px; }
.save-confirm-dialog .file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: #868e96;
}
.save-confirm-dialog .unsaved-indicator {
    color: #ff6b6b;
    font-weight: 500;
}
.save-confirm-dialog .save-confirm-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.save-confirm-dialog .save-icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}
.save-confirm-dialog .save-message p {
    margin: 0 0 6px;
    font-size: 14px;
    color: #343a40;
}
.save-confirm-dialog .save-hint {
    color: #868e96 !important;
    font-size: 13px !important;
}

/* 帮助对话框 */
.help-dialog .help-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    background: #f1f3f5;
    border-radius: 8px;
}
.help-dialog .help-nav-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #495057;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
}
.help-dialog .help-nav-btn:hover {
    background: #e9ecef;
}
.help-dialog .help-nav-btn.active {
    background: #fff;
    color: #1971c2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.help-dialog .help-section {
    display: none;
}
.help-dialog .help-section.active {
    display: block;
}
.help-dialog section {
    margin-bottom: 16px;
}
.help-dialog section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #343a40;
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
}
.help-dialog section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.help-dialog section li {
    padding: 5px 0;
    font-size: 13px;
    color: #495057;
    line-height: 1.5;
}
.help-dialog kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-family: 'SF Mono', 'Menlo', monospace;
    color: #495057;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 1px 0 #dee2e6;
}
.help-dialog .help-version {
    font-size: 12px;
    color: #adb5bd;
    margin-right: auto;
}

/* AI 生成对话框 */
.ai-generate-dialog .generate-options {
    display: flex;
    gap: 16px;
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 8px;
}
.ai-generate-dialog .generate-options .option-group {
    margin-bottom: 0;
}
.ai-generate-dialog .generate-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    margin: 0;
}

/* 通知样式 */
.notification-success,
.notification-error {
    position: fixed;
    top: 16px;
    right: 16px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* 响应式属性面板 */
@media (max-width: 768px) {
    .properties-panel {
        padding: 12px;
    }
    
    .property-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .color-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .color-input-group input[type="color"] {
        width: 100%;
        height: 40px;
    }
    
    .export-options {
        min-width: auto;
    }
    
    .modal-dialog {
        width: 96%;
        max-height: 92vh;
        border-radius: 10px;
    }
    
    .modal-header, .modal-footer {
        padding: 10px 16px;
    }
    
    .modal-content {
        padding: 16px;
    }
}