/* Image Filters Tool - 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;
}

/* Button info - white text */
.btn-info {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
    color: #fff !important;
}

.btn-info:hover,
.btn-info:focus,
.btn-info:active {
    background-color: #31d2f2;
    border-color: #25cff2;
    color: #fff !important;
}

/* 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-info {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
    color: #fff !important;
}

[data-bs-theme="dark"] .btn-info:hover {
    background-color: #3dd5f3;
    border-color: #31d2f2;
    color: #fff !important;
}

[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;
}

/* 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;
}

/* Input group text - prevent selection */
.input-group-text {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: default;
}

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

/* Dark mode card styling */
[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;
}

/* Text colors - Light mode default */

/* Dark mode support - Bootstrap theme system */
/* Additional cursor and selection styles */
.form-control {
    cursor: text;
}

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

.form-select {
    cursor: pointer;
}

.form-range {
    cursor: pointer;
}

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

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

/* Prevent selection on small text elements */
small.text-muted {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: default;
}

/* 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 {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .toolOutput: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;
}

/* Card body text */
.card-body {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Form text help */
.form-text {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: default;
}

/* 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;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#previewCanvas {
    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;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    max-width: 100%;
    height: auto;
}

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

/* Preview container styling */
#previewContainer {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

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

/* Small original preview container - no background */
#originalPreviewContainer {
    margin-top: 0.75rem;
}

/* Dark mode preview images */
[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);
}

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

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

/* Force show download button when it has href */
#downloadLink[href]:not([href="#"]):not([href=""]) {
    display: inline-block !important;
}

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

#downloadLink:visited {
    color: white !important;
    text-decoration: none !important;
}

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

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

/* Override Bootstrap button hover effects completely */
#downloadLink.btn:hover {
    color: white !important;
}

#downloadLink.btn:focus {
    color: white !important;
    box-shadow: none !important;
}

#downloadLink.btn:active {
    color: white !important;
}

#downloadLink.btn:focus-visible {
    color: white !important;
    box-shadow: none !important;
}

/* Range slider styling - Modern and clean */
.form-range {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 10px;
    outline: none;
    padding: 0;
    margin: 0;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #052c65 0%, #0a58ca 100%);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.form-range::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #052c65 0%, #0a58ca 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-range::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.form-range::-moz-range-thumb:active {
    transform: scale(1.1);
}

/* Dark mode range slider */
[data-bs-theme="dark"] .form-range {
    background-color: #495057;
}

[data-bs-theme="dark"] .form-range::-webkit-slider-thumb {
    background: linear-gradient(135deg, #052c65 0%, #1e7ed8 100%);
}

[data-bs-theme="dark"] .form-range::-moz-range-thumb {
    background: linear-gradient(135deg, #052c65 0%, #1e7ed8 100%);
}

/* Filter label styling with icons */
.card-body .form-label {
    display: flex;
    align-items: center;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
    user-select: none;
}

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

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

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

/* Dark mode filter icons */
[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;
}

/* Filter value display */
.card-body .form-label span {
    margin-left: auto;
    font-weight: 600;
    color: #052c65;
    font-size: 0.95rem;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .card-body .form-label span {
    color: #60a5fa;
}

/* Two-column filter layout styling */
.card-body .row {
    margin-left: -8px;
    margin-right: -8px;
}

.card-body .row > [class*='col-'] {
    padding-left: 8px;
    padding-right: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #originalPreviewImage,
    #previewCanvas {
        max-height: 200px;
    }

    /* Reset to default spacing on mobile */
    .card-body .row {
        margin-left: -12px;
        margin-right: -12px;
    }

    .card-body .row > [class*='col-'] {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Loading state styling */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

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

/* Preset button styling */
.preset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border-width: 1.5px;
    white-space: nowrap;
}

.preset-btn img {
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.2);
}

.preset-btn:active {
    transform: translateY(0);
}

/* Dark mode preset buttons */
[data-bs-theme="dark"] .preset-btn {
    border-color: #60a5fa;
    color: #60a5fa;
}

[data-bs-theme="dark"] .preset-btn:hover {
    background-color: #1e3a8a;
    border-color: #60a5fa;
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(96, 165, 250, 0.3);
}

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

/* Responsive preset button layout */
@media (max-width: 768px) {
    .preset-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
    }
    
    .preset-btn img {
        width: 12px !important;
        height: 12px !important;
    }
}
