/* cropImage.css - Premium Crop Image Tool Styles */

/* Main Container Card */
#crop-image-preview-container .card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(59, 130, 246, 0.1);
    overflow: visible;
}

#crop-image-preview-container .card-body {
    padding: 0.75rem;
}

/* Header Section */
.crop-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.crop-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.crop-file-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.crop-file-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Aspect Ratio Buttons */
.aspect-ratio-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.aspect-ratio-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 600;
}

.ratio-btn-group {
    display: flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
}

.ratio-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ratio-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.ratio-btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

/* Crop Container */
.crop-main-container {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 0.5rem;
    position: relative;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px dashed #cbd5e1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.image-crop-container {
    border-radius: 8px;
    overflow: visible;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
}

.crop-image-preview {
    display: block;
    border-radius: 8px;
    width: 100%;
    max-height: 800px;
    height: auto;
    user-select: none;
    object-fit: contain;
}


/* Backdrop Overlay - THE KEY FIX */
.crop-backdrop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    border-radius: 8px;
    overflow: hidden;
}

.crop-backdrop-part {
    position: absolute;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(1px);
}

.crop-backdrop-part.top {
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
}

.crop-backdrop-part.bottom {
    left: 0;
    width: 100%;
    height: 0;
}

.crop-backdrop-part.left {
    left: 0;
}

.crop-backdrop-part.right {
    right: 0;
}

/* Crop Selection Box */
.crop-selection-box {
    position: absolute;
    border: 2px solid #3b82f6;
    box-sizing: border-box;
    cursor: move;
    z-index: 10;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8),
        0 0 20px rgba(59, 130, 246, 0.3);
    background: transparent;
}

/* Rule of Thirds Grid */
.crop-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.6;
}

.grid-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.5);
}

.grid-line.v {
    width: 1px;
    height: 100%;
    top: 0;
}

.grid-line.v:nth-child(1) {
    left: 33.33%;
}

.grid-line.v:nth-child(2) {
    left: 66.66%;
}

.grid-line.h {
    height: 1px;
    width: 100%;
    left: 0;
}

.grid-line.h:nth-child(3) {
    top: 33.33%;
}

.grid-line.h:nth-child(4) {
    top: 66.66%;
}

/* Resize Handles */
.handle-wrapper .handle {
    width: 14px;
    height: 14px;
    background: #ffffff;
    border: 2.5px solid #3b82f6;
    position: absolute;
    border-radius: 50%;
    z-index: 11;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.handle-wrapper .handle:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.4);
}

.handle.tl {
    top: -7px;
    left: -7px;
    cursor: nwse-resize;
}

.handle.tr {
    top: -7px;
    right: -7px;
    cursor: nesw-resize;
}

.handle.bl {
    bottom: -7px;
    left: -7px;
    cursor: nesw-resize;
}

.handle.br {
    bottom: -7px;
    right: -7px;
    cursor: nwse-resize;
}

.handle.tm {
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.handle.bm {
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.handle.ml {
    top: 50%;
    left: -7px;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.handle.mr {
    top: 50%;
    right: -7px;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.handle.tm:hover,
.handle.bm:hover {
    transform: translateX(-50%) scale(1.2);
}

.handle.ml:hover,
.handle.mr:hover {
    transform: translateY(-50%) scale(1.2);
}

/* Size Badge */
.crop-size-badge {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.03em;
}

.crop-size-badge::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #1e293b;
}

/* Controls Section */
.crop-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2e8f0;
}

.crop-dimension-input {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.25rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.crop-dimension-input:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.crop-dimension-input .dim-label {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    min-width: 28px;
    text-align: center;
}

.crop-dimension-input input {
    border: none;
    background: transparent;
    padding: 0.4rem 0.5rem;
    width: 70px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #1e293b;
    text-align: center;
}

.crop-dimension-input input:focus {
    outline: none;
}

.crop-dimension-input .dim-unit {
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    padding-right: 0.5rem;
}

/* Full Image Button */
.use-full-image-btn {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid #cbd5e1;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.use-full-image-btn:hover {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    border-color: #94a3b8;
    color: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.use-full-image-btn i {
    font-size: 0.9rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .crop-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .aspect-ratio-group {
        width: 100%;
    }

    .ratio-btn-group {
        flex-wrap: wrap;
    }

    .crop-controls {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .crop-main-container {
        padding: 1rem;
    }

    .ratio-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }
}