:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-text: #1e293b;
    --checkbox-bg: #ffffff;
    --checkbox-border: #e2e8f0;
    --checkbox-checked: #2563eb;
    --file-input-bg: #ffffff;
    --file-input-text: #1e293b;
    --file-input-border: #e2e8f0;
    /* Theme toggle specific */
    --toggle-active-color: var(--primary-color);
    --toggle-ring-color: rgba(37, 99, 235, 0.1);
    /* Layout Dimensions */
    --app-panel-height: calc(100vh - 7rem);
}

/* Dark mode variables */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --secondary-color: #a3a3a3;
    --background-color: #171717;
    --surface-color: #262626;
    --text-color: #fafafa;
    --border-color: #404040;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --input-bg: #404040;
    --input-border: #525252;
    --input-text: #fafafa;
    --checkbox-bg: #404040;
    --checkbox-border: #525252;
    --checkbox-checked: #3b82f6;
    --file-input-bg: #404040;
    --file-input-text: #fafafa;
    --file-input-border: #525252;
    /* Use grayscale tones for toggle in dark mode */
    --toggle-active-color: #525252;
    --toggle-ring-color: rgba(163, 163, 163, 0.2);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    padding-top: 72px;
    /* Space for fixed header */
}

.container-fluid {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-fluid:not(.app-header .container-fluid) {
    padding: 0.5rem 1rem 2rem 1rem;
}

.controls {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 6px var(--shadow-color);
    height: var(--app-panel-height);
    max-height: var(--app-panel-height);
    position: sticky;
    top: 72px;
    display: flex;
    flex-direction: column;
}

/* Preview Wrapper (contains Preview and Zoom) */
.preview-wrapper {
    height: var(--app-panel-height);
    max-height: var(--app-panel-height);
    position: sticky;
    top: 72px;
    align-items: stretch;
}

.controls-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    flex-shrink: 0;
    background-color: var(--surface-color);
    border-radius: 12px 12px 0 0;
    z-index: 10;
}

.controls-body {
    padding: 0 1.5rem 1.5rem 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    border-radius: 0 0 12px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.controls-body::-webkit-scrollbar {
    width: 6px;
}

.controls-body::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.controls-body::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.controls-body::-webkit-scrollbar-thumb:hover {
    background-color: var(--secondary-color);
}

.form-label {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s ease;
    background-color: var(--input-bg);
    color: var(--input-text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: var(--input-bg);
    color: var(--input-text);
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
}

[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

input[type="file"] {
    background-color: var(--file-input-bg);
    color: var(--file-input-text);
    border: 1px solid var(--file-input-border);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="file"]::-webkit-file-upload-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    margin-right: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="file"]::-webkit-file-upload-button:hover {
    background-color: #1d4ed8;
}

input[type="file"]::file-selector-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    margin-right: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
    background-color: #1d4ed8;
}

.form-range {
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    position: relative;
}

.form-range::-webkit-slider-runnable-track {
    background: transparent;
    border: none;
    height: 6px;
    border-radius: 3px;
}

.form-range::-moz-range-track {
    background: transparent;
    border: none;
    height: 6px;
    border-radius: 3px;
}

.form-range::-webkit-slider-thumb {
    background: var(--primary-color);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid var(--surface-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: -6px;
    /* Center the thumb vertically on the track */
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background: #1d4ed8;
}

.form-range::-moz-range-thumb {
    background: var(--primary-color);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid var(--surface-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: -6px;
    /* Center the thumb vertically on the track */
}

.form-range::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background: #1d4ed8;
}

.form-range:hover {
    background-color: var(--primary-color);
    opacity: 0.8;
}

.form-check-input {
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.125em;
    vertical-align: top;
    background-color: var(--checkbox-bg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: 1px solid var(--checkbox-border);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 0.25em;
    transition: background-color 0.15s ease-in-out, background-position 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-switch .form-check-input:not(:checked) {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23e2e8f0'/%3e%3c/svg%3e");
}

[data-theme="dark"] .form-switch .form-check-input:not(:checked) {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23475569'/%3e%3c/svg%3e");
}

.form-check-input:checked {
    background-color: var(--checkbox-checked);
    border-color: var(--checkbox-checked);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
}

.btn-primary:hover {
    background-color: #4f46e5;
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: var(--secondary-color);
    border: none;
}

.btn-secondary:hover {
    background-color: #475569;
    transform: translateY(-1px);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none !important;
}

#imageContainer {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    height: 100% !important;
    min-height: 100%;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#canvasDropzone {
    flex-grow: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Preview Toolbar (above canvas) */
.preview-toolbar {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 1rem;
}

/* Zoom Controls Panel (below canvas) */
.zoom-controls-panel {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-top: 1rem;
}

/* Vertical Zoom Controls Panel (right of canvas) */
.zoom-controls-panel-vertical {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 0.75rem 0.5rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.toolbar-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.zoom-controls {
    gap: 0.25rem;
}

.toolbar-divider {
    width: 24px;
    height: 1px;
    background-color: var(--border-color);
    margin: 0.25rem 0;
}

.zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--secondary-color);
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.06);
    color: #000000;
}

[data-theme="dark"] .zoom-btn:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: #ffffff;
}

.zoom-btn:active {
    transform: translateY(1px);
}

.zoom-btn svg {
    width: 18px;
    height: 18px;
    color: currentColor;
    fill: currentColor;
}

/* Info Button Styles - Deprecated, use .zoom-btn */
/* .info-btn styles removed */

.zoom-level span#zoomValue {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 0.875rem;
    color: var(--secondary-color);
    min-width: 52px;
    display: inline-block;
    text-align: center;
}

.zoom-level-vertical {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    padding: 0.5rem 0;
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: var(--secondary-color);
    text-align: center;
    cursor: default;
}

/* Editable Number Styles */
.editable-number {
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
}

.editable-number:hover {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

[data-theme="dark"] .editable-number:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.editable-number .form-control-sm {
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
    font-family: inherit;
    font-size: inherit;
    text-align: center;
}

.editable-number .form-control-sm:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* Disabled editable number styles */
.disabled-editable {
    opacity: 0.6;
    cursor: default !important;
    color: var(--secondary-color) !important;
}

.disabled-editable:hover {
    background-color: transparent !important;
    border: none !important;
    color: var(--secondary-color) !important;
}

canvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.range-container {
    margin-bottom: 1rem;
}

.range-value {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 0.875rem;
    color: var(--secondary-color);
    min-width: 3.5em;
    text-align: right;
    margin-left: 0.5rem;
}

.range-value-input {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-color);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    width: 4.5em;
    text-align: center;
    margin-left: 0.5rem;
    transition: all 0.2s ease;
}

.range-value-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.range-value-input::-webkit-inner-spin-button,
.range-value-input::-webkit-outer-spin-button {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.range-value-input:hover::-webkit-inner-spin-button,
.range-value-input:hover::-webkit-outer-spin-button {
    opacity: 1;
}

/* Dual Range Slider Styles */
.range-slider-container {
    margin-bottom: 1rem;
    position: relative;
}

.dual-range-slider {
    position: relative;
    height: 6px;
    width: 100%;
    margin: 20px 0;
}

.range-slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    z-index: 1;
}

.range-slider-fill {
    position: absolute;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 3px;
    z-index: 2;
    cursor: grab;
    /* INSTANT UPDATE: Only transition visual effects, not position/size */
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.range-slider-fill:hover {
    background-color: #1d4ed8;
    transform: scaleY(1.2);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.range-slider-fill:active {
    cursor: grabbing;
    background-color: #1e40af;
    transform: scaleY(1.3);
    box-shadow: 0 3px 6px rgba(37, 99, 235, 0.4);
}

[data-theme="dark"] .range-slider-fill:hover {
    background-color: #2563eb;
}

[data-theme="dark"] .range-slider-fill:active {
    background-color: #1d4ed8;
}

.range-slider-min,
.range-slider-max {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    width: 100%;
    height: 6px;
    background: transparent;
    z-index: 3;
    margin: 0;
    pointer-events: none;
    top: 0;
}

.range-slider-min::-webkit-slider-runnable-track,
.range-slider-max::-webkit-slider-runnable-track {
    background: transparent;
    border: none;
    height: 6px;
    border-radius: 3px;
}

.range-slider-min::-moz-range-track,
.range-slider-max::-moz-range-track {
    background: transparent;
    border: none;
    height: 6px;
    border-radius: 3px;
}

.range-slider-min::-webkit-slider-thumb,
.range-slider-max::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid var(--surface-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    margin-top: -6px;
    transition: all 0.2s ease;
}

.range-slider-min::-webkit-slider-thumb:hover,
.range-slider-max::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background: #1d4ed8;
}

.range-slider-min::-moz-range-thumb,
.range-slider-max::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid var(--surface-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    transition: all 0.2s ease;
}

.range-slider-min::-moz-range-thumb:hover,
.range-slider-max::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background: #1d4ed8;
}

.dual-range-slider:hover .range-slider-track {
    background-color: var(--primary-color);
    opacity: 0.3;
}

.range-slider-min:focus,
.range-slider-max:focus {
    outline: none;
}

.range-values {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

legend {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--secondary-color);
    padding: 0 0.5rem;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .controls {
        position: static;
        margin-bottom: 2rem;
        height: auto;
        max-height: 70vh;
    }

    #imageContainer {
        margin-top: 1rem;
    }
}

.dropzone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    transition: all 0.2s ease;
    background-color: var(--surface-color);
    cursor: pointer;
}

.dropzone:hover {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.02);
}

.dropzone.dragover {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
    transform: scale(1.01);
}

/* Input Dropzone Specific Styles */
#inputDropzone {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    pointer-events: none;
    text-align: center;
    width: 100%;
    min-height: inherit;
}



.dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
    max-width: 200px;
}

.dropzone-primary {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.4;
}

.dropzone-secondary {
    font-size: 0.8rem;
    color: var(--secondary-color);
    line-height: 1.3;
}

.dropzone-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

.dropzone-input::-webkit-file-upload-button {
    display: none;
}

.dropzone-input::file-selector-button {
    display: none;
}

.file-name-display {
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 500;
    text-align: center;
    word-break: break-all;
    padding: 0.5rem 0.75rem;
    background-color: rgba(37, 99, 235, 0.1);
    border-radius: 8px;
    border: 1px solid var(--primary-color);
    max-width: 100%;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    position: relative;
    z-index: 20;
    pointer-events: none;
}

.remove-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    color: var(--text-color);
    opacity: 0.6;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    pointer-events: auto;
}

.remove-file-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    opacity: 1;
    color: #dc3545;
}

[data-theme="dark"] .remove-file-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Canvas Dropzone Styles */
#canvasDropzone .dropzone-text {
    opacity: 0;
    transition: opacity 0.2s ease;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--secondary-color);
    font-size: 0.875rem;
    pointer-events: none;
    text-align: center;
    width: 100%;
    padding: 0 1rem;
    z-index: 3;
}

#canvasDropzone.dragover .canvas-empty-state.hidden ~ .dropzone-text {
    opacity: 1;
}

#canvasDropzone canvas {
    position: relative;
    z-index: 1;
}

/* Canvas Empty State Styles */
.canvas-empty-state {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.canvas-empty-state.hidden {
    opacity: 0;
    pointer-events: none;
}

.empty-state-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

.empty-state-icon {
    color: var(--secondary-color);
    opacity: 0.6;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.dropzone:hover .empty-state-icon {
    color: var(--primary-color);
    opacity: 0.8;
    transform: translateY(-4px);
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.empty-state-formats {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.format-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    color: var(--secondary-color);
}

[data-theme="dark"] .format-badge {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Segmented Control Styles */
.segmented-button {
    display: flex;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
    position: relative;
    width: 100%;
}

.segmented-button input[type="radio"] {
    display: none;
}

.segment-label {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--secondary-color);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    user-select: none;
}

.segment-label:hover {
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .segment-label:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Checked state */
.segmented-button input[type="radio"]:checked+label {
    background-color: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Disabled state */
.segmented-button input[type="radio"]:disabled+label {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: transparent;
    color: var(--secondary-color);
}

/* Control Sections */
.control-section {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
}

.control-section:last-child {
    border-bottom: none;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    cursor: pointer;
    user-select: none;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
}

.section-chevron {
    transition: transform 0.2s ease;
    color: var(--secondary-color);
}

.section-header[aria-expanded="true"] .section-chevron {
    transform: rotate(180deg);
}

.section-content {
    padding-bottom: 1.5rem;
}

/* Keep Image button subtle hover effect */
#keepImage {
    transition: all 0.2s ease;
}

#keepImage:hover {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] #keepImage:hover {
    background-color: #334155 !important;
    border-color: #475569 !important;
}

/* Modal Dialog Improvements */
.modal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    background-color: var(--surface-color);
}

[data-theme="dark"] .modal-content {
    background-color: var(--surface-color);
    border-color: var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
}

.modal-title {
    display: flex;
    align-items: center;
    color: var(--text-color);
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 0 0 12px 12px;
    background-color: var(--surface-color);
}

.modal-footer-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Custom X button for modal */
.btn-close {
    display: none;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background-color: transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: var(--secondary-color);
    padding: 0;
    cursor: pointer;
    z-index: 10;
}

.modal-close-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    transform: scale(1.05);
    color: #ef4444;
}

.modal-close-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background-color: rgba(239, 68, 68, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    z-index: -1;
}

.modal-close-btn svg {
    position: relative;
    transition: transform 0.2s ease;
    pointer-events: none;
}

.modal-close-btn:hover svg {
    transform: rotate(90deg);
}

[data-theme="dark"] .modal-close-btn:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Dark theme Keep and Continue button */
[data-theme="dark"] #keepImage {
    background-color: var(--surface-color) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] #keepImage:hover {
    background-color: var(--border-color) !important;
    border-color: var(--secondary-color) !important;
}

/* App Icon Large */
.app-icon-large {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    box-shadow: 0 4px 6px var(--shadow-color);
    overflow: hidden;
}

/* Tab Navigation in Modal */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    width: 100%;
}

.nav-tabs .nav-link {
    color: var(--secondary-color);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--text-color);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background: transparent;
    border-bottom: 2px solid var(--primary-color);
}

/* Features List */
.features-list ul {
    list-style-type: none;
    padding-left: 0;
}

.features-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.features-list li::before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.features-title {
    font-weight: 600;
    color: var(--text-color);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Copyright Tooltip */
.copyright-link {
    position: relative;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.2s ease;
}

.copyright-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.copyright-tooltip {
    visibility: hidden;
    background-color: var(--text-color);
    color: var(--surface-color);
    text-align: center;
    border-radius: 6px;
    padding: 6px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow: 0 4px 6px var(--shadow-color);
    pointer-events: none;
}

.copyright-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--text-color) transparent transparent transparent;
}

.copyright-link:hover .copyright-tooltip {
    visibility: visible;
    opacity: 1;
}

/* Header Styles */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 2px var(--shadow-color);
}

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

.app-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-color);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.app-icon:hover {
    transform: scale(1.05);
}

.app-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    line-height: 1;
    position: relative;
    cursor: default;
}

.app-version {
    position: absolute;
    top: -4px;
    right: -28px;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--secondary-color);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.app-name:hover .app-version {
    opacity: 1;
}

.header-controls {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.theme-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.theme-toggle-label {
    position: relative;
    display: block;
    width: 56px;
    height: 32px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0;
}

.theme-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background-color: var(--toggle-active-color);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-icon {
    width: 14px;
    height: 14px;
    transition: all 0.3s ease;
}

.sun-icon {
    opacity: 1;
    transform: scale(1);
}

.moon-icon {
    opacity: 0;
    transform: scale(0) rotate(-90deg);
    position: absolute;
}

/* Dark mode toggle state */
.theme-toggle-input:checked+.theme-toggle-label .theme-toggle-slider {
    transform: translateX(24px);
    background-color: var(--toggle-active-color);
}

.theme-toggle-input:checked+.theme-toggle-label .theme-toggle-slider .sun-icon {
    opacity: 0;
    transform: scale(0) rotate(90deg);
}

.theme-toggle-input:checked+.theme-toggle-label .theme-toggle-slider .moon-icon {
    opacity: 1;
    transform: scale(1) rotate(0);
}

.theme-toggle-input:focus+.theme-toggle-label {
    box-shadow: 0 0 0 3px var(--toggle-ring-color);
}

.sidebar-footer {
    padding: 1rem 2rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    text-align: center;
    background-color: var(--surface-color);
    border-radius: 0 0 12px 12px;
}

.copyright-text {
    font-size: 0.75rem;
    color: var(--secondary-color);
    margin: 0;
}

/* Modal Buttons */
.discover-btn {
    background-color: var(--primary-color);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    color: white;
    transition: all 0.2s ease;
    margin-bottom: 0;
}

.discover-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.feedback-btn {
    background-color: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 0;
}

.feedback-btn:hover {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

[data-theme="dark"] .feedback-btn {
    background-color: var(--surface-color) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .feedback-btn:hover {
    background-color: var(--border-color) !important;
    border-color: var(--secondary-color) !important;
}

/* EULA Section Styles */
.eula-text {
    padding: 1rem;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.eula-text h6 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: center;
}

.eula-text p {
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.eula-text p:last-child {
    margin-bottom: 0;
}

.eula-text strong {
    font-weight: 600;
    color: var(--text-color);
}

[data-theme="dark"] .eula-text {
    background-color: var(--surface-color);
}

/* Custom Minimal Tabs for About Modal */
#aboutModalTabs {
    border-bottom: 1px solid var(--border-color);
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
    gap: 1rem;
}

#aboutModalTabs .nav-item {
    margin-bottom: -1px;
}

#aboutModalTabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--secondary-color);
    padding: 0.5rem 0.25rem;
    font-weight: 500;
    background: transparent;
    transition: all 0.2s ease;
}

#aboutModalTabs .nav-link:hover {
    color: var(--text-color);
    border-color: transparent;
    isolation: isolate;
}

#aboutModalTabs .nav-link.active {
    color: var(--primary-color);
    background: transparent;
    border-bottom-color: var(--primary-color);
}

[data-theme="dark"] #aboutModalTabs .nav-link:hover {
    color: var(--text-color);
}

[data-theme="dark"] #aboutModalTabs .nav-link.active {
    color: var(--primary-color);
}

/* Modal Content Adjustments */
#aboutModalTabContent .tab-pane {
    padding-right: 0.5rem;
}

/* Copyright Footer Styles */
.copyright-footer {
    color: var(--secondary-color);
    font-size: 0.75rem;
}

.copyright-link {
    color: inherit;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
    display: inline-block;
    padding-bottom: 2px;
}

.copyright-link:hover {
    color: var(--primary-color);
    text-decoration: none !important;
}

/* Underline effect */
.copyright-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s ease;
}

.copyright-link:hover::after {
    transform: scaleX(1);
}

/* Tooltip container */
.copyright-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background-color: var(--text-color);
    color: var(--surface-color);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
    transition-delay: 1.2s;
    margin-bottom: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

/* Tooltip Arrow */
.copyright-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -4px;
    border-width: 4px;
    border-style: solid;
    border-color: var(--text-color) transparent transparent transparent;
}

.copyright-link:hover .copyright-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* Responsive adjustments for modal */
@media (max-width: 768px) {
    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 1rem;
    }

    .modal-title {
        font-size: 1.125rem;
    }

    .app-icon-large {
        width: 28px;
        height: 28px;
    }

    .app-icon-text {
        font-size: 11px;
    }

    .discover-btn,
    .feedback-btn {
        padding: 0.625rem 1.5rem;
        font-size: 0.875rem;
    }

    .eula-text {
        font-size: 0.8rem;
        padding: 0.75rem;
    }
}

/* Processing Indicator */
.processing-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface-color);
    backdrop-filter: blur(4px);
    padding: 1rem 2rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    box-shadow: 0 4px 6px var(--shadow-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.processing-indicator.hidden {
    display: none !important;
}
