/* Image Blur Tool Pro - Custom Styles */

/* Remove input validation borders */
.toolInput:invalid,
.toolInput:valid {
    border-color: #ced4da !important;
    box-shadow: none !important;
}

.toolInput:focus {
    border-color: #80bdff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* Cursor pointers for interactive elements */
.btn {
    cursor: pointer;
}

.toolBtn {
    cursor: pointer;
}

/* Button icons styling */
.toolBtn img {
    transition: all 0.2s ease;
}

/* Dark mode button styling */
[data-bs-theme="dark"] .btn-success {
    background-color: #198754;
    border-color: #198754;
}

[data-bs-theme="dark"] .btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

[data-bs-theme="dark"] .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

[data-bs-theme="dark"] .btn-secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    color: #adb5bd;
    border-color: #6c757d;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

[data-bs-theme="dark"] .btn-outline-danger {
    color: #ea868f;
    border-color: #dc3545;
}

[data-bs-theme="dark"] .btn-outline-danger:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

/* Prevent text selection on badges and labels */
.badge {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: default;
}

.form-label {
    cursor: default;
}

/* Dark mode form labels */
[data-bs-theme="dark"] .form-label {
    color: #e9ecef;
}

/* Card styling */
.card-header h5 {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: default;
}

[data-bs-theme="dark"] .card {
    background-color: #212529;
    border-color: #495057;
}

[data-bs-theme="dark"] .card-header {
    background-color: #1a1d20;
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .card-header h5 {
    color: #e9ecef;
}

/* Blur Mode Selection */
.blur-mode-option {
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.form-check-input:checked + .form-check-label .blur-mode-option {
    border-color: #052c65;
    background-color: #e6f0ff;
}

[data-bs-theme="dark"] .blur-mode-option {
    border-color: #495057;
}

[data-bs-theme="dark"] .form-check-input:checked + .form-check-label .blur-mode-option {
    border-color: #052c65;
    background-color: #0a1628;
}

.blur-mode-option:hover {
    border-color: #052c65;
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.blur-mode-option img {
    display: inline-block;
    margin-bottom: 0.25rem;
}

[data-bs-theme="dark"] .blur-mode-option img {
    filter: brightness(0) invert(1);
}

.form-check:not(.form-switch) {
    padding-left: 0;
}

.form-check:not(.form-switch) .form-check-input {
    display: none;
}

/* Selection Canvas */
.canvas-wrapper {
    position: relative;
    display: block;
    max-width: 100%;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    overflow: hidden;
}

#selectionContainer .form-label {
    display: block;
    margin-bottom: 0.5rem;
}

#selectionContainer .canvas-wrapper {
    display: block;
    margin-bottom: 0.5rem;
}

.selection-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

[data-bs-theme="dark"] .canvas-wrapper {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.4);
}

/* Form controls */
.form-control {
    cursor: text;
}

.form-control[readonly] {
    cursor: default;
}

.form-select {
    cursor: pointer;
}

.form-range {
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    cursor: pointer;
}

.form-range::-moz-range-thumb {
    cursor: pointer;
}

input[type="checkbox"], input[type="radio"] {
    cursor: pointer;
}

input[type="file"] {
    cursor: pointer;
}

/* Dark mode text elements */
[data-bs-theme="dark"] small.text-muted {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .form-text {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .toolOutput,
[data-bs-theme="dark"] .form-select {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .toolOutput:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #1a1d20;
    border-color: #052c65;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-control[readonly],
[data-bs-theme="dark"] .toolOutput[readonly] {
    background-color: #1a1d20;
    color: #adb5bd;
}

/* Preview image styling */
#originalPreviewImage {
    max-height: 120px;
    max-width: 200px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.15s ease-in-out;
    object-fit: contain;
    cursor: pointer;
    user-select: none;
}

#originalPreviewImage:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

[data-bs-theme="dark"] #originalPreviewImage {
    border-color: #495057;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] #originalPreviewImage:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.6);
}

/* Canvas styling */
canvas {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    user-select: none;
}

/* Preview boxes */
.preview-box {
    position: relative;
}

.preview-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 0.95rem;
}

[data-bs-theme="dark"] .preview-label {
    color: #e9ecef;
}

/* Processing status */
#processingStatus {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Alert info - brand color theme */
.alert-info {
    background-color: #e6f0ff;
    border-color: #052c65;
    color: #052c65;
}

[data-bs-theme="dark"] .alert-info {
    background-color: #0a1628;
    border-color: #1e4a8a;
    color: #93c5fd;
}

/* Spinner - brand color */
.spinner-border {
    border-color: rgba(5, 44, 101, 0.2);
    border-right-color: #052c65;
    width: 1.5rem;
    height: 1.5rem;
}

[data-bs-theme="dark"] .spinner-border {
    border-color: rgba(147, 197, 253, 0.2);
    border-right-color: #93c5fd;
}

/* Download button styling */
#downloadLink {
    color: white !important;
    text-decoration: none !important;
}

#downloadLink[href]:not([href="#"]):not([href=""]) {
    display: inline-block !important;
}

#downloadLink:hover,
#downloadLink:focus,
#downloadLink:active {
    color: white !important;
    text-decoration: none !important;
}

/* Auto-resize textarea */
.auto-resize-textarea {
    overflow: hidden;
    resize: none;
    min-height: 38px;
    transition: height 0.2s ease;
}

/* Card body label icons */
.card-body .form-label img {
    opacity: 0.7;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.card-body .form-label:hover img {
    opacity: 1;
}

[data-bs-theme="dark"] .card-body .form-label img {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

[data-bs-theme="dark"] .card-body .form-label:hover img {
    filter: brightness(0) invert(1);
    opacity: 1;
}

/* Button icons in outline buttons */
.btn-outline-secondary img,
.btn-outline-danger img {
    opacity: 0.7;
    transition: all 0.2s ease;
}

.btn-outline-secondary:hover img,
.btn-outline-danger:hover img {
    opacity: 1;
}

[data-bs-theme="dark"] .btn-outline-secondary img,
[data-bs-theme="dark"] .btn-outline-danger img {
    filter: brightness(0) invert(1);
}

/* Button group styling */
.btn-group .btn-outline-primary {
    border-color: #052c65;
    color: #052c65;
}

.btn-group .btn-outline-primary:hover {
    background-color: #e6f0ff;
    color: #052c65;
}

.btn-group .btn-check:checked + .btn-outline-primary {
    background-color: #052c65;
    border-color: #052c65;
    color: white;
}

.btn-group .btn-outline-primary img {
    opacity: 0.7;
    transition: filter 0.2s ease;
}

.btn-group .btn-check:checked + .btn-outline-primary img {
    filter: brightness(0) invert(1);
    opacity: 1;
}

[data-bs-theme="dark"] .btn-group .btn-outline-primary {
    border-color: #6ea8fe;
    color: #6ea8fe;
}

[data-bs-theme="dark"] .btn-group .btn-outline-primary:hover {
    background-color: rgba(110, 168, 254, 0.1);
    color: #9ec5fe;
}

[data-bs-theme="dark"] .btn-group .btn-check:checked + .btn-outline-primary {
    background-color: #6ea8fe;
    border-color: #6ea8fe;
    color: #000;
}

[data-bs-theme="dark"] .btn-group .btn-outline-primary img {
    filter: invert(64%) sepia(52%) saturate(600%) hue-rotate(193deg) brightness(100%) contrast(100%);
}

[data-bs-theme="dark"] .btn-group .btn-check:checked + .btn-outline-primary img {
    filter: brightness(0);
}

/* Form switch styling - restore Bootstrap defaults */
.form-check.form-switch {
    padding-left: 2.5em;
}

.form-check.form-switch .form-check-input {
    width: 2em;
    margin-left: -2.5em;
    cursor: pointer;
}

.form-check.form-switch .form-check-label {
    cursor: pointer;
}

.form-check.form-switch .form-check-label small {
    display: block;
    margin-top: 0.1rem;
}

.form-check-label img {
    opacity: 0.7;
}

[data-bs-theme="dark"] .form-check-label img {
    filter: brightness(0) invert(1);
}

/* Selection tools card header */
#selectionToolsCard .card-header {
    padding: 0.75rem 1rem;
}

#selectionToolsCard .card-header .badge {
    font-size: 0.85em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #originalPreviewImage {
        max-height: 150px;
        max-width: 100%;
    }

    .preview-box {
        margin-bottom: 1rem;
    }

    .canvas-wrapper {
        max-width: 100%;
    }

    .selection-canvas {
        width: 100%;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.25rem;
    }

    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

/* Preview container animation */
#previewContainer {
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Blur Intensity Slider */
#blurIntensity,
#brushSize {
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        #e9ecef,
        #e9ecef 5px,
        #d3d6d9 5px,
        #d3d6d9 10px
    );
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

#blurIntensity::-webkit-slider-thumb,
#brushSize::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #052c65;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#blurIntensity::-webkit-slider-thumb:hover,
#brushSize::-webkit-slider-thumb:hover {
    background: #041f4a;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

#blurIntensity::-moz-range-thumb,
#brushSize::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #052c65;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#blurIntensity::-moz-range-thumb:hover,
#brushSize::-moz-range-thumb:hover {
    background: #041f4a;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

#blurIntensity::-webkit-slider-runnable-track {
    height: 8px;
    background: linear-gradient(to right,
        #052c65 0%,
        #052c65 var(--value, 18.37%),
        transparent var(--value, 18.37%)),
        repeating-linear-gradient(
            45deg,
            #e9ecef,
            #e9ecef 5px,
            #d3d6d9 5px,
            #d3d6d9 10px
        );
    border-radius: 4px;
}

#blurIntensity::-moz-range-track,
#brushSize::-moz-range-track {
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        #e9ecef,
        #e9ecef 5px,
        #d3d6d9 5px,
        #d3d6d9 10px
    );
    border-radius: 4px;
}

#blurIntensity::-moz-range-progress,
#brushSize::-moz-range-progress {
    height: 8px;
    background: #052c65;
    border-radius: 4px;
}

/* Dark mode slider */
[data-bs-theme="dark"] #blurIntensity,
[data-bs-theme="dark"] #brushSize {
    background: repeating-linear-gradient(
        45deg,
        #343a40,
        #343a40 5px,
        #495057 5px,
        #495057 10px
    );
}

[data-bs-theme="dark"] #blurIntensity::-webkit-slider-thumb,
[data-bs-theme="dark"] #brushSize::-webkit-slider-thumb {
    background: #6ea8fe;
}

[data-bs-theme="dark"] #blurIntensity::-webkit-slider-thumb:hover,
[data-bs-theme="dark"] #brushSize::-webkit-slider-thumb:hover {
    background: #9ec5fe;
}

[data-bs-theme="dark"] #blurIntensity::-moz-range-thumb,
[data-bs-theme="dark"] #brushSize::-moz-range-thumb {
    background: #6ea8fe;
}

[data-bs-theme="dark"] #blurIntensity::-moz-range-thumb:hover,
[data-bs-theme="dark"] #brushSize::-moz-range-thumb:hover {
    background: #9ec5fe;
}

[data-bs-theme="dark"] #blurIntensity::-webkit-slider-runnable-track {
    background: linear-gradient(to right,
        #6ea8fe 0%,
        #6ea8fe var(--value, 18.37%),
        transparent var(--value, 18.37%)),
        repeating-linear-gradient(
            45deg,
            #343a40,
            #343a40 5px,
            #495057 5px,
            #495057 10px
        );
}

[data-bs-theme="dark"] #blurIntensity::-moz-range-track,
[data-bs-theme="dark"] #brushSize::-moz-range-track {
    background: repeating-linear-gradient(
        45deg,
        #343a40,
        #343a40 5px,
        #495057 5px,
        #495057 10px
    );
}

[data-bs-theme="dark"] #blurIntensity::-moz-range-progress,
[data-bs-theme="dark"] #brushSize::-moz-range-progress {
    background: #6ea8fe;
}

/* Undo/Redo buttons disabled state */
#undoBtn:disabled,
#redoBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#undoBtn:disabled img,
#redoBtn:disabled img {
    opacity: 0.5;
}
