* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: var(--vscode-scrollbarSlider-background);
    border-radius: 7px;
}

::-webkit-scrollbar-thumb {
    background: var(--vscode-scrollbarSlider-background);
    border-radius: 7px;
    border: 2px solid var(--vscode-editor-background);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--vscode-scrollbarSlider-hoverBackground);
}

::-webkit-scrollbar-corner {
    background: var(--vscode-editor-background);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--vscode-editor-background);
    color: var(--vscode-editor-foreground);
    height: 100vh;
    overflow: auto;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
}

.header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--vscode-panel-border);
}

.title {
    font-size: 18px;
    font-weight: 600;
}

.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px;
    background: var(--vscode-panel-background);
    border-radius: 8px;
    border: 1px solid var(--vscode-panel-border);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.control-group label {
    font-size: 12px;
    color: var(--vscode-descriptionForeground);
}

.btn {
    background: var(--vscode-button-background);
    color: var(--vscode-button-foreground);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--vscode-button-hoverBackground);
}

.btn:disabled {
    background: var(--vscode-button-secondaryBackground);
    color: var(--vscode-button-secondaryForeground);
    cursor: not-allowed;
}

.btn.active {
    background: #4CAF50;
    color: white;
}

.btn.save-btn {
    background: var(--vscode-button-prominentBackground);
    color: var(--vscode-button-prominentForeground);
}

.btn.save-btn:hover {
    background: var(--vscode-button-prominentHoverBackground);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.image-container {
    flex: 1;
    background: var(--vscode-editor-background);
    border: 1px solid var(--vscode-panel-border);
    border-radius: 8px;
    padding: 20px;
    position: relative;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 0;
}

.image-wrapper {
    position: relative;
    max-width: 100%;
    transform-origin: center center;
    margin: auto;
    overflow: visible;
}

#image {
    max-width: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    display: block;
    z-index: 1;
    position: relative;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    color: var(--vscode-descriptionForeground);
    padding: 5px;
    background: var(--vscode-panel-background);
    border-radius: 6px;
    border: 1px solid var(--vscode-panel-border);
}

.file-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.file-info-label {
    font-size: 10px;
    opacity: 0.7;
}

.file-info-value {
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: 500;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 16px;
    color: var(--vscode-descriptionForeground);
}

.error {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--vscode-errorForeground);
    text-align: center;
    padding: 20px;
}

.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    background: var(--vscode-panel-background);
    border-radius: 8px;
    border: 1px solid var(--vscode-panel-border);
    margin-bottom: 15px;
}

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

.filter-group label {
    font-size: 12px;
    color: var(--vscode-descriptionForeground);
    min-width: 60px;
}

.filter-slider {
    width: 100px;
}

.filter-presets {
    display: flex;
    gap: 5px;
}

.filter-sliders {
    display: flex;
    gap: 15px;
    align-items: center;
}

.preset-btn {
    background: var(--vscode-button-secondaryBackground);
    color: var(--vscode-button-secondaryForeground);
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.2s;
}

.preset-btn:hover {
    background: var(--vscode-button-secondaryHoverBackground);
}

.preset-btn.active {
    background: var(--vscode-button-background);
    color: var(--vscode-button-foreground);
}

/* Edit Mode Styles */
.edit-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    background: var(--vscode-panel-background);
    border-radius: 8px;
    border: 1px solid var(--vscode-panel-border);
    margin-bottom: 15px;
}

.edit-tools {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.edit-btn {
    background: var(--vscode-button-secondaryBackground);
    color: var(--vscode-button-secondaryForeground);
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.2s;
}

.edit-btn:hover {
    background: var(--vscode-button-secondaryHoverBackground);
}

.edit-btn.active {
    background: var(--vscode-button-background);
    color: var(--vscode-button-foreground);
}

.selection-info {
    font-size: 11px;
    color: var(--vscode-descriptionForeground);
    margin-left: 10px;
    padding: 2px 6px;
    background: var(--vscode-badge-background);
    color: var(--vscode-badge-foreground);
    border-radius: 3px;
}

.edit-properties {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

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

.property-group label {
    font-size: 12px;
    color: var(--vscode-descriptionForeground);
    min-width: 60px;
}

.property-group input[type="color"] {
    width: 30px;
    height: 25px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    background: linear-gradient(45deg, transparent 0%, transparent 50%, #ccc 50%, #ccc 100%);
}

.property-group input[type="range"] {
    width: 80px;
}

.property-group input[type="text"] {
    padding: 4px 8px;
    border: 1px solid var(--vscode-input-border);
    border-radius: 3px;
    background: var(--vscode-input-background);
    color: var(--vscode-input-foreground);
    font-size: 11px;
    width: 120px;
}

.edit-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    width: 100%;
    height: 100%;
    background: rgba(0, 255, 0, 0.05);
    overflow: visible;
    border: 1px solid rgba(255, 0, 0, 0.3);
    box-sizing: border-box;
}

.edit-canvas.active {
    pointer-events: auto;
    cursor: crosshair;
}

.edit-canvas.select-mode {
    cursor: pointer;
}

.shape-element {
    position: absolute;
    cursor: move;
    user-select: none;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(0, 0, 0, 0.8);
    opacity: 1;
}

.shape-element.selected {
    outline: 2px dashed #007acc;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3);
}

.shape-element .resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #007acc;
    border: 1px solid white;
    border-radius: 50%;
    cursor: se-resize;
    z-index: 10001;
}

.shape-element .resize-handle.top-left {
    top: -4px;
    left: -4px;
    cursor: nw-resize;
}

.shape-element .resize-handle.top-right {
    top: -4px;
    right: -4px;
    cursor: ne-resize;
}

.shape-element .resize-handle.bottom-left {
    bottom: -4px;
    left: -4px;
    cursor: sw-resize;
}

.shape-element .resize-handle.bottom-right {
    bottom: -4px;
    right: -4px;
    cursor: se-resize;
}

.text-element {
    position: absolute;
    cursor: move;
    user-select: none;
    background: transparent;
    padding: 0;
    min-width: 30px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-weight: bold;
    opacity: 1;
}

.text-element.selected {
    outline: 2px dashed #007acc;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3);
}

.text-element.editing {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

.text-element input {
    border: none;
    background: transparent;
    outline: none;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    width: 100%;
    text-align: center;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
}

.modal {
    background: var(--vscode-panel-background);
    border: 1px solid var(--vscode-panel-border);
    border-radius: 8px;
    padding: 20px;
    min-width: 400px;
    max-width: 500px;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--vscode-editor-foreground);
}

.modal-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--vscode-input-border);
    border-radius: 4px;
    background: var(--vscode-input-background);
    color: var(--vscode-input-foreground);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    margin-bottom: 15px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--vscode-focusBorder);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.modal-btn.primary {
    background: var(--vscode-button-background);
    color: var(--vscode-button-foreground);
}

.modal-btn.primary:hover {
    background: var(--vscode-button-hoverBackground);
}

.modal-btn.secondary {
    background: var(--vscode-button-secondaryBackground);
    color: var(--vscode-button-secondaryForeground);
}

.modal-btn.secondary:hover {
    background: var(--vscode-button-secondaryHoverBackground);
}
