/**
 * crop.css - Styles for the image cropping and resizing tool
 * This file contains all styles specific to crop.html and crop.js functionality
 */

/* Type selector styles */
.type-selector {
    display: flex;
    margin: 1.5rem 0;
    gap: 15px;
    flex-wrap: wrap;
}

.type-option {
    flex: 1;
    min-width: 150px;
    text-align: center;
    padding: 1.25rem 1rem;
    border-radius: 12px;
    background-color: #fff;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.type-option:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(93, 95, 239, 0.15);
}

.type-option.selected {
    border-color: var(--primary-color);
    background-color: rgba(93, 95, 239, 0.1);
    box-shadow: 0 4px 12px rgba(93, 95, 239, 0.2);
}

.type-option i {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    display: block;
}

.type-option-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}

.type-option-desc {
    font-size: 0.85rem;
    color: #6c757d;
}

/* File upload styles */
.file-upload-container {
    position: relative;
    margin: 1.5rem 0;
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    transition: all 0.3s ease;
    background-color: rgba(248, 249, 250, 0.7);
}

.file-upload-container:hover {
    border-color: var(--primary-color);
    background-color: rgba(93, 95, 239, 0.05);
}

.file-upload-container i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

.file-upload-text {
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 1.1rem;
}

.file-upload-subtext {
    font-size: 0.85rem;
    color: #6c757d;
}

.file-input-hidden {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

/* Crop container styles */
.crop-container {
    width: 100%;
    max-width: 100%;
    max-height: none;
    min-height: 320px;
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f0f0f0;
    position: relative;
    padding-bottom: 30px;
    touch-action: none;
    border: 1px solid #ddd;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1);
}

/* Image canvas styling */
#image {
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
    touch-action: none;
}

/* Ensure the image is rendered properly */
.img-fluid {
    max-width: 100%;
    height: auto;
    touch-action: none;
}

/* Zoom controls */
.zoom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 50px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    flex-wrap: nowrap;
}

.zoom-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.zoom-btn:hover {
    transform: translateY(-2px);
    background-color: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.zoom-slider {
    width: 150px;
    margin: 0 10px;
    flex-grow: 1;
    max-width: 50%;
}

.zoom-slider::-webkit-slider-thumb {
    background: var(--primary-color);
    cursor: pointer;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    -webkit-appearance: none;
}

.zoom-slider::-moz-range-thumb {
    background: var(--primary-color);
    cursor: pointer;
    height: 18px;
    width: 18px;
    border-radius: 50%;
}

/* Reset image button */
.reset-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    white-space: nowrap;
    flex-shrink: 0;
    height: 36px;
    display: flex;
    align-items: center;
}

.reset-btn:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Preview styles */
.preview-container {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

.preview-heading {
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.preview-image-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.preview-img {
    max-width: 100%;
    max-height: 350px;
    border-radius: 8px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    border: 3px solid white;
}

.download-container {
    text-align: center;
    margin: 1.5rem 0 0.5rem;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Custom Size Options */
#custom-size-options {
    background: var(--bs-light);
    padding: 1.25rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

#custom-size-options .input-group {
    max-width: 100%;
}

/* Quality Selector */
.quality-selector {
    margin-top: 1rem;
}

.quality-selector .btn-group {
    display: flex;
    gap: 0.5rem;
}

.quality-selector .btn {
    flex: 1;
    padding: 1rem 0.5rem;
    text-align: center;
    border-radius: 0.5rem !important;
}

.quality-selector .btn small {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.quality-selector .btn-check:checked + .btn {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

.quality-selector .btn-check:checked + .btn small {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Unit selector */
.unit-selector {
    width: 100%;
}

.unit-selector .btn {
    padding: 8px 12px;
    font-weight: 500;
}

/* Responsive styles */
@media (max-width: 768px) {
    .type-selector {
        flex-direction: column;
        gap: 12px;
    }

    .zoom-slider {
        width: 40%;
        min-width: 100px;
    }

    .zoom-controls {
        padding: 8px;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: center;
        gap: 8px;
    }

    .zoom-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 16px;
    }

    .reset-btn {
        font-size: 13px;
        padding: 7px 12px;
        height: 32px;
    }

    .crop-instruction {
        font-size: 0.9rem;
    }

    .file-upload-container {
        padding: 1.75rem 1rem;
    }

    .file-upload-container i {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }

    .file-upload-text {
        font-size: 1rem;
    }

    .quality-selector .btn-group {
        flex-direction: column;
    }
    
    .quality-selector .btn {
        width: 100%;
        margin-right: 0 !important;
    }
    
    #custom-size-options .row > div {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .unit-selector .btn {
        font-size: 0.85rem;
        padding: 5px 8px;
        min-width: 30px;
    }
    
    #custom-size-options {
        padding: 1rem;
    }
    
    #custom-size-options .form-label {
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
    }
    
    .input-group-text {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    #custom-size-options .input-group {
        margin-bottom: 0.75rem;
    }
    
    #custom-size-options .form-control {
        font-size: 0.9rem;
        padding: 6px 8px;
    }
    
    #custom-size-options .form-check {
        margin-top: 0.5rem;
    }

    .preview-container {
        padding: 1.5rem;
    }
    
    /* Compact unit buttons on small screens */
    .unit-selector .btn {
        font-size: 0.85rem;
        padding: 5px 8px;
    }
    
    /* Ensure width/height are properly sized on mobile */
    #custom-size-options .input-group-text {
        font-size: 0.85rem;
        padding: 6px;
    }
    
    #custom-size-options .input-group .form-control {
        font-size: 0.9rem;
        padding: 8px 6px;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    #custom-size-options .col-6 {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}