/* Image Cropper Tool Styles */

/* Crop Container */
.crop-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.crop-image {
    display: block;
    max-width: 100%;
    height: auto;
    user-select: none;
    pointer-events: none;
}

/* Crop Overlay */
.crop-overlay {
    position: absolute;
    border: 2px solid #052c65;
    background: rgba(5, 44, 101, 0.1);
    cursor: move;
    user-select: none;
    pointer-events: auto;
    z-index: 10;
}

.crop-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #052c65;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    pointer-events: auto;
    z-index: 11;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.crop-handle:hover {
    transform: scale(1.3);
    background: #0d47a1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.crop-handle:active {
    transform: scale(1.1);
    background: #1565c0;
}

/* Handle positions */
.crop-handle-nw {
    top: -8px;
    left: -8px;
    cursor: nw-resize;
}

.crop-handle-ne {
    top: -8px;
    right: -8px;
    cursor: ne-resize;
}

.crop-handle-sw {
    bottom: -8px;
    left: -8px;
    cursor: sw-resize;
}

.crop-handle-se {
    bottom: -8px;
    right: -8px;
    cursor: se-resize;
}

.crop-handle-n {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
}

.crop-handle-s {
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
}

.crop-handle-w {
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    cursor: w-resize;
}

.crop-handle-e {
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
    cursor: e-resize;
}

/* Form Controls */
.form-check {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--bs-primary-text-emphasis);
    border-radius: 0.5rem;
    background-color: #fafafa;
    transition: all 0.2s ease;
    cursor: pointer;
}

.form-check:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: #052c65;
}

.form-check-input[type="radio"] {
    width: 1.1em;
    height: 1.1em;
    margin-top: 0.1em;
    border: 1.5px solid #d1d5db;
    transition: all 0.2s ease;
    cursor: pointer;
}

.form-check-input[type="radio"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
    transform: scale(1.05);
}

.form-check-input[type="radio"]:hover {
    transform: scale(1.08);
    border-color: #3b82f6;
}

.form-check-label {
    font-weight: 400;
    color: #374151;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.form-check-label img {
    opacity: 0.7;
    transition: all 0.2s ease;
}

.form-check:hover .form-check-label img {
    opacity: 1;
    transform: scale(1.05);
}

/* Range Slider Styling */
.form-range {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    transition: all 0.2s ease;
}

.form-range::-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(5, 44, 101, 0.3);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(5, 44, 101, 0.4);
}

.form-range::-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(5, 44, 101, 0.3);
}

.form-range::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(5, 44, 101, 0.4);
}

/* Button Styling */
.btn, .toolBtn {
    cursor: pointer;
}

/* Crop button disabled state */
#cropBtn:disabled {
    background-color: var(--bs-primary-text-emphasis);
    border-color: var(--bs-primary-text-emphasis);
    opacity: 0.65;
}

/* Download button styling - matches other buttons exactly */
#downloadLink {
    color: white !important;
    text-decoration: none !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;
}

/* Loading animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

[data-bs-theme="dark"] .crop-container {
    border-color: #4a5568;
    background: #2d3748;
}

[data-bs-theme="dark"] .crop-overlay {
    border-color: #052c65;
    background: rgba(5, 44, 101, 0.2);
}

[data-bs-theme="dark"] .crop-handle {
    background: #052c65;
    border-color: #2d3748;
}

[data-bs-theme="dark"] .crop-handle:hover {
    background: #0d47a1;
}

[data-bs-theme="dark"] .form-check {
    background-color: #2d3748;
    border-color: var(--bs-primary-text-emphasis);
}

[data-bs-theme="dark"] .form-check:hover {
    border-color: #052c65;
    background-color: #1a365d;
}

[data-bs-theme="dark"] .form-check-input[type="radio"] {
    border-color: #4a5568;
}

[data-bs-theme="dark"] .form-check-input[type="radio"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

[data-bs-theme="dark"] .form-check-input[type="radio"]:hover {
    border-color: #3b82f6;
}

[data-bs-theme="dark"] .form-check-label {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-range {
    background: #4a5568;
}

[data-bs-theme="dark"] .form-range::-webkit-slider-thumb {
    background: #052c65;
    box-shadow: 0 2px 4px rgba(5, 44, 101, 0.5);
}

[data-bs-theme="dark"] .form-range::-moz-range-thumb {
    background: #052c65;
    box-shadow: 0 2px 4px rgba(5, 44, 101, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {

    .crop-container {
        max-width: 100%;
    }

    .crop-handle {
        width: 20px;
        height: 20px;
    }

    .crop-handle-nw {
        top: -10px;
        left: -10px;
    }

    .crop-handle-ne {
        top: -10px;
        right: -10px;
    }

    .crop-handle-sw {
        bottom: -10px;
        left: -10px;
    }

    .crop-handle-se {
        bottom: -10px;
        right: -10px;
    }

    .crop-handle-n {
        top: -10px;
    }

    .crop-handle-s {
        bottom: -10px;
    }

    .crop-handle-w {
        left: -10px;
    }

    .crop-handle-e {
        right: -10px;
    }
}
