.photo-editor-wrap {
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    color: var(--text-color, #333);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    height: 700px;
    position: relative;
}
.photo-editor-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px 8px 0 0;
    background: var(--card-bg, #fafafa);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.photo-editor-menu {
    display: flex;
    gap: 2px;
}
.photo-editor-menu-btn {
    padding: 5px 10px;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--text-color, #333);
    cursor: pointer;
    border-radius: 4px;
}
.photo-editor-menu-btn:hover {
    background: var(--primary-light, #e8eefc);
}
.photo-editor-tool-options {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    flex-wrap: wrap;
}
.photo-editor-tool-name {
    font-weight: 600;
    color: var(--primary, #2563eb);
    font-size: 12px;
    min-width: 70px;
}
.photo-editor-options-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.photo-editor-options-content label {
    font-size: 12px;
    color: var(--text-secondary, #666);
}
.photo-editor-options-content input[type="range"] {
    width: 100px;
}
.photo-editor-options-content input[type="number"] {
    width: 55px;
    padding: 3px 6px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    font-size: 12px;
}
.photo-editor-options-content select {
    padding: 3px 6px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    font-size: 12px;
}
.photo-editor-actions {
    display: flex;
    gap: 6px;
}
.photo-editor-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-color, #d0d0d0);
    border-radius: 6px;
    background: var(--btn-bg, #fff);
    font-size: 12px;
    color: var(--text-secondary, #555);
    cursor: pointer;
    transition: all 0.15s;
}
.photo-editor-btn:hover:not(:disabled) {
    background: var(--primary, #2563eb);
    color: #fff;
    border-color: var(--primary, #2563eb);
}
.photo-editor-btn.primary {
    background: var(--primary, #2563eb);
    color: #fff;
    border-color: var(--primary, #2563eb);
}
.photo-editor-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.photo-editor-btn-small {
    padding: 2px 6px;
    font-size: 11px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    background: var(--btn-bg, #f9fafb);
    cursor: pointer;
    color: var(--text-secondary, #666);
}
.photo-editor-btn-small:hover {
    background: var(--primary, #2563eb);
    color: #fff;
}
.photo-editor-icon-btn {
    width: 22px;
    height: 22px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    background: var(--btn-bg, #f9fafb);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #666);
}
.photo-editor-icon-btn:hover {
    background: var(--primary, #2563eb);
    color: #fff;
}
.photo-editor-menu-dropdown {
    position: fixed;
    z-index: 10000;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    padding: 4px 0;
    min-width: 160px;
}
.photo-editor-menu-item {
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-color, #333);
}
.photo-editor-menu-item:hover {
    background: var(--primary-light, #e8eefc);
    color: var(--primary, #2563eb);
}
.photo-editor-menu-item.separator {
    height: 1px;
    background: var(--border-color, #eee);
    padding: 0;
    margin: 2px 0;
    cursor: default;
}
.photo-editor-main {
    flex: 1;
    display: flex;
    border: 1px solid var(--border-color, #e0e0e0);
    border-top: none;
    overflow: hidden;
    min-height: 0;
}
.photo-editor-toolbar {
    width: 44px;
    background: var(--card-bg, #f5f5f5);
    border-right: 1px solid var(--border-color, #e0e0e0);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0;
    gap: 2px;
    flex-shrink: 0;
    overflow-y: auto;
}
.photo-editor-tool {
    width: 34px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #555);
    transition: all 0.15s;
}
.photo-editor-tool:hover {
    background: var(--primary-light, #e8eefc);
}
.photo-editor-tool.active {
    background: var(--primary, #2563eb);
    color: #fff;
    border-color: var(--primary, #2563eb);
}
.photo-editor-canvas-area {
    flex: 1;
    position: relative;
    overflow: auto;
    background: repeating-conic-gradient(#e5e7eb 0% 25%, #fff 0% 50%) 50% / 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.photo-editor-canvas-wrap {
    position: relative;
    flex-shrink: 0;
}
.photo-editor-canvas-wrap canvas {
    position: absolute;
    top: 0;
    left: 0;
}
#photo-editor-main-canvas {
    position: relative;
}
#photo-editor-overlay-canvas {
    pointer-events: none;
}
.photo-editor-text-input {
    position: absolute;
    border: 1px dashed var(--primary, #2563eb);
    background: transparent;
    outline: none;
    font-family: sans-serif;
    padding: 2px;
    z-index: 10;
}
.photo-editor-canvas-hint {
    position: absolute;
    text-align: center;
    color: var(--text-muted, #999);
    font-size: 14px;
}
.photo-editor-hint-icon {
    font-size: 48px;
    margin-bottom: 10px;
}
.photo-editor-right-panel {
    width: 200px;
    border-left: 1px solid var(--border-color, #e0e0e0);
    background: var(--card-bg, #fafafa);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    flex-shrink: 0;
    overflow-y: auto;
}
.photo-editor-panel {
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    background: var(--card-bg, #fff);
    overflow: hidden;
}
.photo-editor-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--card-bg, #f5f5f5);
    border-bottom: 1px solid var(--border-color, #eee);
}
.photo-editor-layer-actions {
    display: flex;
    gap: 3px;
}
.photo-editor-layer-list {
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
}
.photo-editor-layer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-bottom: 2px;
}
.photo-editor-layer-item:hover {
    background: var(--primary-light, #e8eefc);
}
.photo-editor-layer-item.active {
    background: var(--primary, #2563eb);
    color: #fff;
}
.photo-editor-layer-visibility {
    width: 16px;
    text-align: center;
    cursor: pointer;
    font-size: 11px;
}
.photo-editor-layer-thumb {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 2px;
    background: #fff;
    flex-shrink: 0;
}
.photo-editor-layer-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.photo-editor-layer-props {
    padding: 6px 8px;
    border-top: 1px solid var(--border-color, #eee);
}
.photo-editor-prop-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--text-secondary, #666);
}
.photo-editor-prop-row:last-child {
    margin-bottom: 0;
}
.photo-editor-prop-row input[type="range"] {
    flex: 1;
    min-width: 60px;
}
.photo-editor-prop-row span:last-child {
    min-width: 32px;
    text-align: right;
}
.photo-editor-select-sm {
    flex: 1;
    padding: 2px 4px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 3px;
    font-size: 11px;
}
.photo-editor-color-box {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
}
.photo-editor-color-swatch {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border-color, #ccc);
    border-radius: 4px;
    cursor: pointer;
    background: #000;
}
.photo-editor-color-swatch.photo-editor-bg-color {
    background: #fff;
    margin-left: -10px;
    margin-top: 10px;
}
.photo-editor-statusbar {
    display: flex;
    justify-content: space-between;
    padding: 4px 10px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: var(--card-bg, #f5f5f5);
    font-size: 11px;
    color: var(--text-muted, #999);
    flex-shrink: 0;
}
@media (max-width: 900px) {
    .photo-editor-wrap { height: auto; }
    .photo-editor-right-panel { width: 160px; }
    .photo-editor-main { flex-direction: column; }
    .photo-editor-toolbar { flex-direction: row; width: 100%; overflow-x: auto; }
    .photo-editor-right-panel { width: 100%; border-left: none; border-top: 1px solid var(--border-color, #e0e0e0); }
}

.photo-editor-history-item {
    padding: 3px 6px;
    border-radius: 3px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.photo-editor-history-item:hover {
    background: var(--primary-light, #e8eefc);
}
.photo-editor-history-item.active {
    background: var(--primary, #2563eb);
    color: #fff;
}
