/*
 * Enhanced Image Cropper with Rotate, Flip and Shape Features
 * Updated version with animations removed and smooth shadow hovers
 */

/* Dragging Conflict Fix: Applied via JS to body */
body.mt-ic-is-dragging,
body.mt-ic-is-dragging * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Base and Wrapper */
.mt-ic-wrapper * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
.mt-ic-wrapper {
    font-family: 'Inter', sans-serif;
    color: #1f2937;
}

/* Theme/Page Builder Overrides */
.elementor-widget-container,
.elementor-widget-wrap,
.ast-container,
.ast-single-post-order-section,
.elementor-section-wrap,
.elementor-container {
    overflow: visible !important;
}

/* Glass Card */
body {
  overflow-x: hidden;
}

.mt-ic-wrapper {
  width: 100%;
  max-width: 100%;
  padding: 16px;
  box-sizing: border-box;
  overflow-x: hidden;
}

.mt-ic-wrapper .mt-ic-glass-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  transition: all 0.3s ease;
  padding: 16px;
}

@media (max-width: 400px) {
  .mt-ic-wrapper {
    padding: 12px;
  }

  .mt-ic-wrapper .mt-ic-glass-card {
    padding: 12px;
    border-radius: 12px;
  }
}

.mt-ic-wrapper .mt-ic-glass-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* Typography & Buttons */
.mt-ic-wrapper .mt-ic-gradient-text {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.mt-ic-wrapper .mt-ic-btn-gradient {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.mt-ic-wrapper .mt-ic-btn-gradient:hover {
    background: linear-gradient(135deg, #1d4ed8, #7c3aed);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}
.mt-ic-wrapper .mt-ic-btn-gradient:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}
.mt-ic-wrapper .mt-ic-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.mt-ic-wrapper .mt-ic-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}
.mt-ic-wrapper .mt-ic-btn-secondary:hover {
    background: #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.mt-ic-wrapper .mt-ic-btn-danger {
    background: transparent;
    color: #ef4444;
    border: 2px solid #ef4444;
}
.mt-ic-wrapper .mt-ic-btn-danger:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Layout */
.mt-ic-wrapper .mt-ic-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
    background: #ffffff;
    border: 3px solid #d1d5db;
    border-radius: 20px;
    position: relative;
    transition: border 0.3s ease;
}

.mt-ic-wrapper .mt-ic-container:hover {
    border: 3px solid transparent;
    background: linear-gradient(#ffffff, #ffffff) padding-box,
                linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899) border-box;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.mt-ic-wrapper .mt-ic-main {
    padding: 1rem 0 2rem;
}
.mt-ic-wrapper .mt-ic-hero {
    text-align: center;
    margin-bottom: 2rem;
}
.mt-ic-wrapper .mt-ic-hero h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.mt-ic-wrapper .mt-ic-hero p {
    font-size: 1.25rem;
    color: #6b7280;
    margin-bottom: 1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.mt-ic-wrapper .mt-ic-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
@media (max-width: 768px) {
    .mt-ic-wrapper .mt-ic-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .mt-ic-wrapper .mt-ic-hero h2 {
        font-size: 2rem;
    }
    .mt-ic-wrapper .mt-ic-hero p {
        font-size: 1rem;
    }
}

/* Upload & Crop Area */
.mt-ic-wrapper .mt-ic-upload-area { padding: 1.5rem; }
.mt-ic-wrapper .mt-ic-drag-zone { 
    border: 2px dashed #e5e7eb; 
    border-radius: 12px; 
    padding: 3rem 2rem; 
    text-align: center; 
    transition: all 0.3s ease; 
    background: rgba(249, 250, 251, 0.5); 
}
.mt-ic-wrapper .mt-ic-drag-zone.dragover, .mt-ic-wrapper .mt-ic-drag-zone:hover { 
    border-color: #3b82f6; 
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}
.mt-ic-wrapper .mt-ic-upload-icon { 
    font-size: 3rem; 
    color: #3b82f6; 
    margin-bottom: 1rem; 
}

/* Crop Container - Mobile Optimized */
.mt-ic-wrapper .mt-ic-crop-container { 
    position: relative; 
    width: 100%; 
    height: 400px; 
    background: #f3f4f6; 
    border-radius: 12px; 
    overflow: hidden; 
    touch-action: none; 
    user-select: none; 
    -webkit-user-select: none;
    -webkit-overflow-scrolling: touch;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    will-change: transform;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
}

.mt-ic-wrapper .mt-ic-crop-image { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    transform-origin: center center; 
    pointer-events: none; 
}

/* Crop Overlay - Mobile Enhanced */
.mt-ic-wrapper .mt-ic-crop-overlay { 
    position: absolute; 
    border: 2px dashed #3b82f6; 
    background: rgba(59, 130, 246, 0.1); 
    cursor: move;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 40px;
    min-height: 40px;
    will-change: transform, left, top, width, height;
    transform: translateZ(0);
    overflow: visible !important;
}

/* Resize Handles - Responsive Design */
.mt-ic-wrapper .mt-ic-resize-handle { 
    position: absolute; 
    background: #3b82f6; 
    border: 3px solid white; 
    border-radius: 50%; 
    z-index: 200; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow 0.3s ease;
}

.mt-ic-wrapper .mt-ic-resize-handle:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Desktop Resize Handles */
@media (min-width: 769px) { 
    .mt-ic-wrapper .mt-ic-resize-handle { 
        width: 12px; 
        height: 12px; 
    } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-nw { top: -3px; left: -3px; cursor: nw-resize; } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-ne { top: -3px; right: -3px; cursor: ne-resize; } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-sw { bottom: -3px; left: -3px; cursor: sw-resize; } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-se { bottom: -3px; right: -3px; cursor: se-resize; } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-n { top: -3px; left: 50%; transform: translateX(-50%); cursor: n-resize; } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-s { bottom: -3px; left: 50%; transform: translateX(-50%); cursor: s-resize; } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-w { top: 50%; left: -3px; transform: translateY(-50%); cursor: w-resize; } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-e { top: 50%; right: -3px; transform: translateY(-50%); cursor: e-resize; } 
}

/* Mobile responsive fixes */
@media (max-width: 768px) { 
    .mt-ic-wrapper .mt-ic-crop-container { 
        height: 300px; 
    }
    
    /* Fix mobile preview boxes overflowing */
    .mt-ic-wrapper .mt-ic-preview-grid { 
        grid-template-columns: 1fr; 
        gap: 1rem;
        overflow-x: hidden;
    }
    
    .mt-ic-wrapper .mt-ic-preview-image { 
        max-width: 100%; 
        width: 100%;
        box-sizing: border-box;
    }
    
    .mt-ic-wrapper .mt-ic-preview-item {
        overflow: hidden;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Fix button sizes and text for mobile */
    .mt-ic-wrapper .mt-ic-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .mt-ic-wrapper .mt-ic-control-title {
        font-size: 1rem;
    }
    
    .mt-ic-wrapper .mt-ic-preview-info {
        font-size: 0.7rem;
    }
    
    .mt-ic-wrapper .mt-ic-hero h2 {
        font-size: 1.75rem;
    }
    
    .mt-ic-wrapper .mt-ic-hero p {
        font-size: 0.9rem;
    }
    
    /* Ensure container doesn't overflow on mobile */
    .mt-ic-wrapper {
        overflow-x: hidden;
    }
    
    .mt-ic-wrapper .mt-ic-container {
        padding: 20px 12px;
        overflow-x: hidden;
    } 
    .mt-ic-wrapper .mt-ic-resize-handle { 
        width: 18px; 
        height: 18px; 
        border-width: 2px;
        opacity: 0.8;
        background: #3b82f6;
        transition: all 0.2s ease;
    } 
    .mt-ic-wrapper .mt-ic-resize-handle:active {
        opacity: 1;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    }
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-nw { 
        top: -4px; 
        left: -4px; 
    } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-ne { 
        top: -4px; 
        right: -4px; 
    } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-sw { 
        bottom: -4px; 
        left: -4px; 
    } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-se { 
        bottom: -4px; 
        right: -4px; 
    } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-n, 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-s { 
        left: 50%; 
        transform: translateX(-50%); 
    } 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-n:active, 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-s:active { 
        transform: translateX(-50%);
    }
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-n { 
        top: -4px; 
    }
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-s { 
        bottom: -4px; 
    }
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-w, 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-e { 
        top: 50%; 
        transform: translateY(-50%); 
    }
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-w:active, 
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-e:active { 
        transform: translateY(-50%);
    }
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-w { 
        left: -4px; 
    }
    .mt-ic-wrapper .mt-ic-resize-handle.mt-ic-e { 
        right: -4px; 
    }
}

/* Controls */
.mt-ic-wrapper .mt-ic-controls { padding: 1.5rem; }
.mt-ic-wrapper .mt-ic-control-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem; color: #1f2937; }
.mt-ic-wrapper .mt-ic-aspect-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 1rem; }
@media (max-width: 768px) { .mt-ic-wrapper .mt-ic-aspect-buttons { grid-template-columns: 1fr 1fr 1fr; } }
.mt-ic-wrapper .mt-ic-aspect-btn { 
    padding: 0.75rem; 
    border: 2px solid #e5e7eb; 
    background: #f9fafb; 
    border-radius: 8px; 
    cursor: pointer; 
    text-align: center; 
    font-weight: 500; 
    color: #334155 !important; 
    transition: all 0.3s ease;
}
.mt-ic-wrapper .mt-ic-aspect-btn div { color: #334155 !important; }
.mt-ic-wrapper .mt-ic-aspect-btn:hover, .mt-ic-wrapper .mt-ic-aspect-btn.active { 
    border-color: #3b82f6; 
    background: #3b82f6; 
    color: white !important; 
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.mt-ic-wrapper .mt-ic-aspect-btn:hover div, .mt-ic-wrapper .mt-ic-aspect-btn.active div { color: white !important; }
.mt-ic-wrapper .mt-ic-format-select {
    width: 100% !important;
    padding: 0.75rem !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    background: #f9fafb !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    color: #1f2937 !important;
    height: auto !important;
    box-shadow: none !important;
    transition: all 0.3s ease !important;
}
.mt-ic-wrapper .mt-ic-format-select:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}
.mt-ic-wrapper .mt-ic-zoom-controls { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
    margin-top: 1rem; 
    padding: 1rem; 
    background: rgba(255, 255, 255, 0.8); 
    border-radius: 12px; 
    backdrop-filter: blur(10px); 
}
.mt-ic-wrapper .mt-ic-zoom-btn { 
    width: 44px; 
    height: 44px; 
    border: none; 
    background: #f3f4f6; 
    border-radius: 8px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.3s ease;
}
.mt-ic-wrapper .mt-ic-zoom-btn:hover {
    background: #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.mt-ic-wrapper .mt-ic-slider-container { margin: 1rem 0; }
.mt-ic-wrapper .mt-ic-slider { width: 100%; -webkit-appearance: none; height: 6px; border-radius: 3px; background: #e5e7eb; outline: none; }
.mt-ic-wrapper .mt-ic-slider::-webkit-slider-thumb { 
    -webkit-appearance: none; 
    appearance: none; 
    width: 20px; 
    height: 20px; 
    border-radius: 50%; 
    background: #3b82f6; 
    cursor: pointer; 
    transition: all 0.3s ease;
}
.mt-ic-wrapper .mt-ic-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

/* Preview */
.mt-ic-wrapper .mt-ic-preview { margin-top: 2rem; }
.mt-ic-wrapper .mt-ic-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .mt-ic-wrapper .mt-ic-preview-grid { grid-template-columns: 1fr; } }
.mt-ic-wrapper .mt-ic-preview-item { text-align: center; }
.mt-ic-wrapper .mt-ic-preview-title { font-weight: 600; margin-bottom: 0.5rem; color: #6b7280; }
.mt-ic-wrapper .mt-ic-preview-image { 
    width: 100%; 
    max-height: 200px; 
    object-fit: contain; 
    background: #f3f4f6; 
    border-radius: 12px; 
    margin-bottom: 0.5rem; 
    transition: all 0.3s ease;
}
.mt-ic-wrapper .mt-ic-preview-image:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.mt-ic-wrapper .mt-ic-preview-info { font-size: 0.75rem; color: #9ca3af; }
.mt-ic-wrapper .mt-ic-hidden { display: none !important; }

/* Dropdown Styles for Rotate & Flip and Crop to Shape Features */
.mt-ic-wrapper .mt-ic-dropdown-container {
    position: relative;
}

.mt-ic-wrapper .mt-ic-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 0.5rem;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.mt-ic-wrapper .mt-ic-dropdown-item {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

.mt-ic-wrapper .mt-ic-dropdown-item:last-child {
    border-bottom: none;
}

.mt-ic-wrapper .mt-ic-dropdown-item:hover {
    background: #f8fafc;
    color: #3b82f6;
    box-shadow: inset 0 0 8px rgba(59, 130, 246, 0.1);
}

.mt-ic-wrapper .mt-ic-dropdown-item:active {
    background: #e0f2fe;
}

.mt-ic-wrapper .mt-ic-dropdown-item i {
    width: 16px;
    text-align: center;
    color: inherit;
}

/* Transform Controls Mobile Optimization */
@media (max-width: 768px) {
    .mt-ic-wrapper .mt-ic-transform-controls > div {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .mt-ic-wrapper .mt-ic-dropdown-item {
        padding: 1rem;
        font-size: 0.9rem;
    }
}

/* Shape Overlay Styles */
.mt-ic-wrapper .mt-ic-crop-overlay.shape-circle {
    border-radius: 50%;
    border-style: solid;
}

.mt-ic-wrapper .mt-ic-crop-overlay.shape-oval {
    border-radius: 50%;
    border-style: solid;
}

.mt-ic-wrapper .mt-ic-crop-overlay.shape-square {
    border-radius: 0;
    border-style: solid;
}

.mt-ic-wrapper .mt-ic-crop-overlay.shape-rectangle {
    border-radius: 0;
    border-style: dashed;
}

.mt-ic-wrapper .mt-ic-crop-overlay.shape-polygon {
    border-style: dotted;
    border-radius: 0;
}

/* Webcam Modal Styles */
.mt-ic-wrapper .mt-ic-webcam-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
    backdrop-filter: blur(5px);
}

.mt-ic-wrapper .mt-ic-webcam-content {
    background: white;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    position: relative;
    max-width: 90%;
    transition: all 0.3s ease;
}

.mt-ic-wrapper .mt-ic-webcam-content:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.mt-ic-wrapper .mt-ic-webcam-content video {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
}

.mt-ic-wrapper .mt-ic-webcam-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s ease;
}

.mt-ic-wrapper .mt-ic-webcam-close:hover {
    color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

/*hide label button upload buuton*/
.mt-ic-upload-area label.mt-ic-btn-gradient {
    display: none !important;
}
/*hide clockwise counterclockwise buuton*/
#mt-ic-rotate-flip-select option[value="clockwise"],
#mt-ic-rotate-flip-select option[value="counterclockwise"] {
    display: none !important;
}