/**
 * SuperSoft SmartCrop - Editor Stylesheet
 * Version 2.0.1
 */

/* Crop Button inside .input-group */
.input-group .smartcrop-crop-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 3;
}

.input-group .smartcrop-crop-btn.btn-success {
    background-color: #198754;
    border-color: #198754;
    color: #ffffff;
}

.input-group .smartcrop-crop-btn.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

/* Media Field Image Preview: allow Big Picture Ghost to float freely outside container on hover */
joomla-field-media .field-media-preview,
.field-media-preview {
    position: relative !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    border-radius: 4px;
}

/* Media Field Image Preview: Fix Joomla core duplicate class glitch and hide empty/broken preview */
.field-media-preview .preview_empty.hidden,
.field-media-preview .preview_empty[class*="hidden"] {
    display: none !important;
}

/* If preview container has an img with valid src, hide preview_empty */
.field-media-preview:has(.preview_img img[src]:not([src=""]):not([src="#"])) .preview_empty,
.field-media-preview:has(> img[src]:not([src=""]):not([src="#"])) .preview_empty {
    display: none !important;
}

/* If no valid image in preview_img, hide broken img icon and preview_img container */
.field-media-preview .preview_img img[src=""],
.field-media-preview .preview_img img:not([src]),
.field-media-preview .preview_img img[src="#"] {
    display: none !important;
}

.field-media-preview:not(:has(img[src]:not([src=""]):not([src="#"]))) .preview_img {
    display: none !important;
}

/* Ensure preview_img lets flexbox directly center children without causing stretching */
.field-media-preview .preview_img {
    display: contents !important;
}

/* Standard un-cropped preview image: perfectly centered, natural aspect ratio, never stretched or distorted */
.field-media-preview img:not(.smartcrop-preview-frame img),
.field-media-preview .preview_img > img:not(.smartcrop-preview-frame img) {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: auto !important;
    align-self: center !important;
}

/* Base Preview Frame */
joomla-field-media .smartcrop-preview-frame,
.field-media-preview .smartcrop-preview-frame,
.resource-visual-overlay .smartcrop-preview-frame {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    max-height: 100% !important;
    max-width: 100% !important;
    margin: auto !important;
    align-self: center !important;
    border-radius: 4px;
    cursor: default !important;
    box-sizing: border-box !important;
    z-index: 2 !important;
    transition: box-shadow 0.2s ease, transform 0.2s ease !important;
}

/* Cropped Preview Frame (overflow: visible allows ghost to extend outside frame) */
joomla-field-media .smartcrop-preview-frame.is-cropped,
.field-media-preview .smartcrop-preview-frame.is-cropped,
.resource-visual-overlay .smartcrop-preview-frame.is-cropped {
    overflow: visible !important;
    aspect-ratio: 4 / 3 !important;
    box-shadow: none !important;
    background-color: transparent;
}

/* Un-cropped Preview Frame: no clipping, no aspect ratio */
joomla-field-media .smartcrop-preview-frame:not(.is-cropped),
.field-media-preview .smartcrop-preview-frame:not(.is-cropped),
.resource-visual-overlay .smartcrop-preview-frame:not(.is-cropped) {
    overflow: visible !important;
    box-shadow: none !important;
}

/* Inner clip container: strictly clips the cropped image to the frame bounds */
.smartcrop-preview-clip {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    border-radius: 4px !important;
    z-index: 2 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: box-shadow 0.2s ease, transform 0.15s ease !important;
}

.smartcrop-preview-frame:not(.is-cropped) .smartcrop-preview-clip {
    position: relative !important;
    overflow: visible !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
}

/* Cropped image inside frame */
joomla-field-media .smartcrop-preview-frame.is-cropped img:not(.smartcrop-preview-ghost),
.field-media-preview .smartcrop-preview-frame.is-cropped img:not(.smartcrop-preview-ghost),
.resource-visual-overlay .smartcrop-preview-frame.is-cropped img:not(.smartcrop-preview-ghost) {
    position: absolute !important;
    max-width: none !important;
    max-height: none !important;
    display: block !important;
    object-fit: fill !important;
    pointer-events: none !important;
}

/* Un-cropped image inside frame: height 100%, width auto, object-fit contain */
.smartcrop-preview-frame:not(.is-cropped) img:not(.smartcrop-preview-ghost) {
    height: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
    display: block !important;
    margin: auto !important;
    border-radius: 4px;
}

/* SmartCrop Overlay Button inside standalone Joomla Media Field Preview (outside SmartBrowser actionsContainer) */
:where(.field-media-preview, .smartcrop-preview-frame, .resource-visual-overlay) > .smartcrop-preview-btn {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    z-index: 10 !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    padding: 4px 7px !important;
    border-radius: 4px !important;
    border: 1px solid transparent !important;
    cursor: pointer !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    backdrop-filter: blur(4px) !important;
    transition: opacity 0.2s ease, transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.15s ease !important;
}

/* Uncropped state (standalone media field preview) */
:where(.field-media-preview, .smartcrop-preview-frame, .resource-visual-overlay) > .smartcrop-preview-btn:not(.is-cropped) {
    opacity: 0.85 !important;
    pointer-events: auto !important;
    background: rgba(33, 37, 41, 0.82) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: none !important;
}

:where(.field-media-preview, .smartcrop-preview-frame, .resource-visual-overlay) > .smartcrop-preview-btn:not(.is-cropped):hover,
:where(.field-media-preview, .smartcrop-preview-frame, .resource-visual-overlay) > .smartcrop-preview-btn:not(.is-cropped):focus-visible {
    opacity: 1 !important;
    background: #0d6efd !important;
    border-color: #0d6efd !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45) !important;
    transform: none !important;
}

/* Cropped state (standalone media field preview) */
:where(.field-media-preview, .smartcrop-preview-frame, .resource-visual-overlay) > .smartcrop-preview-btn.is-cropped {
    opacity: 0.85 !important;
    pointer-events: auto !important;
    background: rgba(25, 135, 84, 0.85) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: none !important;
}

:where(.field-media-preview, .smartcrop-preview-frame, .resource-visual-overlay) > .smartcrop-preview-btn.is-cropped:hover,
:where(.field-media-preview, .smartcrop-preview-frame, .resource-visual-overlay) > .smartcrop-preview-btn.is-cropped:focus-visible {
    opacity: 1 !important;
    background: #198754 !important;
    border-color: #157347 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
    transform: none !important;
}

/* Big Picture Ghost Layer: identical zoom & position, overflows frame freely behind clip */
.smartcrop-preview-ghost {
    position: absolute !important;
    max-width: none !important;
    max-height: none !important;
    pointer-events: none !important;
    z-index: 1 !important;
    opacity: 0 !important;
    border-radius: 6px !important;
    filter: brightness(0.92) contrast(0.96);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Stacking context: when hovering/revealing, elevate preview and frame above inputs and adjacent controls */
.field-media-preview.is-revealing-ghost,
.field-media-preview:has(.is-revealing-ghost),
.field-media-preview:has(.smartcrop-preview-btn:hover),
joomla-field-media:has(.is-revealing-ghost),
joomla-field-media:has(.smartcrop-preview-btn:hover),
.resource-lightweight-area.is-revealing-ghost,
.resource-lightweight-area:has(.is-revealing-ghost),
.resource-info-panel:has(.is-revealing-ghost),
.sb-selected-panel:has(.is-revealing-ghost),
.sb-selection-field:has(.is-revealing-ghost),
.sb-selection-field.is-revealing-ghost,
.smartbrowser-collection:has(.is-revealing-ghost) {
    z-index: 1050 !important;
    overflow: visible !important;
}

.resource-lightweight-visual {
    position: relative !important;
}

/* SmartBrowser Visual Overlay Integration (.resource-visual-overlay) */
.resource-visual-overlay {
    pointer-events: none !important;
}

.resource-visual-overlay > .smartcrop-preview-btn {
    top: 8px !important;
    right: 8px !important;
    z-index: 1065 !important;
    pointer-events: auto !important;
}

/* SmartBrowser Unified Action Toolbar Integration (context.actionsContainer):
   Host toolbar manages button geometry, positioning, sizing, and .selected state. */
.resource-lightweight-actions .smartcrop-preview-btn,
.resource-lightweight-preview-action .smartcrop-preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.resource-visual-overlay .smartcrop-preview-frame {
    position: absolute !important;
    overflow: visible !important;
    border-radius: 4px !important;
    transition: box-shadow 0.2s ease !important;
}

.resource-visual-overlay .smartcrop-preview-clip {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    border-radius: 4px !important;
    z-index: 2 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: box-shadow 0.2s ease !important;
}

.resource-visual-overlay .smartcrop-cropped-preview {
    position: absolute !important;
    max-width: none !important;
    max-height: none !important;
    display: block !important;
    object-fit: fill !important;
    pointer-events: none !important;
}

.resource-visual-overlay .smartcrop-preview-ghost,
.smartcrop-preview-ghost {
    position: absolute !important;
    max-width: none !important;
    max-height: none !important;
    pointer-events: none !important;
    z-index: 1 !important;
    opacity: 0 !important;
    border-radius: 6px !important;
    filter: brightness(0.92) contrast(0.96);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    transition: opacity 0.2s ease !important;
}

/* Badge layer (resource-node-visual-symbol) must always stack cleanly in front of crop and overlays */
.resource-lightweight-visual .resource-visual-layer.resource-node-visual-symbol,
.resource-visual-layer.resource-node-visual-symbol,
.resource-visual-layer.style-badge,
.resource-visual-layer.asset-identity,
.resource-visual-layer.asset-base.style-badge {
    z-index: 25 !important;
    pointer-events: none !important;
}

/* All crop frame preview elements must not block pointer events from action buttons */
.smartcrop-preview-frame,
.resource-visual-overlay .smartcrop-preview-frame,
.smartcrop-preview-clip,
.resource-visual-overlay .smartcrop-preview-clip,
.smartcrop-cropped-preview,
.resource-visual-overlay .smartcrop-cropped-preview {
    pointer-events: none !important;
}

/* Cropped visual image layer: overflow hidden when normal */
.resource-visual-layer.asset-image.has-image-crop,
.resource-lightweight-visual .resource-visual-layer.asset-image {
    overflow: hidden !important;
}

/* Reveal Big Picture Ghost: allow containers to overflow freely */
.smartcrop-preview-frame.is-cropped.is-revealing-ghost,
.smartcrop-preview-frame.is-cropped:has(.smartcrop-preview-btn:hover),
.resource-lightweight-visual.is-revealing-ghost,
.resource-lightweight-visual:has(.is-revealing-ghost),
.resource-lightweight-visual:has(.smartcrop-preview-btn:hover) {
    overflow: visible !important;
    z-index: 1 !important;
}

.field-media-preview.is-revealing-ghost,
.field-media-preview:has(.is-revealing-ghost),
.field-media-preview:has(.smartcrop-preview-btn:hover),
.resource-lightweight-area.is-revealing-ghost,
.resource-lightweight-area:has(.is-revealing-ghost),
.resource-lightweight-area:has(.smartcrop-preview-btn:hover),
.resource-visual-overlay-layer:has(.is-revealing-ghost),
.resource-visual-overlay.is-revealing-ghost,
.resource-visual-overlay:has(.smartcrop-preview-btn:hover),
.resource-info-preview:has(.is-revealing-ghost),
.resource-info-preview:has(.smartcrop-preview-btn:hover) {
    z-index: 1050 !important;
    overflow: visible !important;
}

/* Internal clip wrapper inside fallback custom frame */
.smartcrop-preview-frame .smartcrop-preview-clip {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    border-radius: 4px !important;
    z-index: 2 !important;
    pointer-events: none !important;
}

/* Reveal Big Picture Ghost on scissors / crop button hover */
.smartcrop-preview-frame.is-revealing-ghost .smartcrop-preview-ghost,
.smartcrop-preview-frame:has(.smartcrop-preview-btn:hover) .smartcrop-preview-ghost,
.resource-lightweight-visual.is-revealing-ghost .smartcrop-preview-ghost,
.resource-lightweight-visual:has(.smartcrop-preview-btn:hover) .smartcrop-preview-ghost,
.resource-lightweight-area.is-revealing-ghost .smartcrop-preview-ghost,
.resource-lightweight-area:has(.smartcrop-preview-btn:hover) .smartcrop-preview-ghost,
.resource-visual-overlay.is-revealing-ghost .smartcrop-preview-ghost,
.resource-visual-overlay:has(.smartcrop-preview-btn:hover) .smartcrop-preview-ghost,
.is-revealing-ghost .smartcrop-preview-ghost {
    opacity: 0.75 !important;
    z-index: 1 !important;
}

/* Clean highlight outline when revealing ghost without layout thrashing */
.resource-lightweight-visual.is-cropped.is-revealing-ghost,
.resource-lightweight-visual.is-cropped:has(.smartcrop-preview-btn:hover),
.smartcrop-preview-frame.is-cropped.is-revealing-ghost .smartcrop-preview-clip,
.smartcrop-preview-frame.is-cropped:has(.smartcrop-preview-btn:hover) .smartcrop-preview-clip {
    outline: 2px solid #198754 !important;
    outline-offset: -1px !important;
}

/* Suppress SmartBrowser action-bar buttons when SmartCrop overlay button is active */
.resource-lightweight-actions button:not(.smartcrop-preview-btn)[title*="SmartCrop"],
.resource-lightweight-actions button:not(.smartcrop-preview-btn)[aria-label*="SmartCrop"],
.resource-lightweight-actions button:not(.smartcrop-preview-btn):has(.fa-crop-simple),
.sb-article-image-field .resource-lightweight-actions button:not(.smartcrop-preview-btn):has(.fa-crop-simple),
.sb-article-image-preview ~ * .resource-lightweight-actions button:not(.smartcrop-preview-btn):has(.fa-crop-simple),
.sb-native-preview-host ~ * .resource-lightweight-actions button:not(.smartcrop-preview-btn):has(.fa-crop-simple),
.sb-native-preview-host .resource-lightweight-actions button:not(.smartcrop-preview-btn):has(.fa-crop-simple),
joomla-field-media .resource-lightweight-actions button:not(.smartcrop-preview-btn):has(.fa-crop-simple) {
    display: none !important;
}

/* Hide legacy dashed trigger widget below field */
.smartcrop-field-widget {
    display: none !important;
}

.smartcrop-field-widget .smartcrop-open-modal-btn {
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.smartcrop-field-widget .smartcrop-badge {
    font-size: 0.8rem;
    padding: 0.35em 0.65em;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.smartcrop-field-widget .smartcrop-clear-btn {
    padding: 0.2rem 0.5rem;
    line-height: 1;
}

/* Modal Styling (Compact, Zero-Scroll, Standalone overlay) */
dialog.smartcrop-modal,
.smartcrop-modal {
    display: none;
    border: none !important;
    outline: none !important;
    margin: 0 !important;
    padding: 0.75rem !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    color: inherit;
    box-sizing: border-box !important;
}

dialog.smartcrop-modal:not([open]):not(.show):not(.smartcrop-modal-visible) {
    display: none !important;
}

dialog.smartcrop-modal[open],
.smartcrop-modal.smartcrop-modal-visible,
.smartcrop-modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483640 !important;
    background-color: rgba(0, 0, 0, 0.72) !important;
    backdrop-filter: blur(2px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.75rem;
    box-sizing: border-box;
    opacity: 1 !important;
}

dialog.smartcrop-modal::backdrop {
    background: transparent !important;
}

.smartcrop-modal.smartcrop-modal-visible .modal-dialog,
.smartcrop-modal.show .modal-dialog {
    width: 100%;
    max-width: 600px;
    margin: auto;
    transform: none !important;
}

.smartcrop-modal .modal-content {
    background-color: var(--bs-body-bg, #ffffff);
    color: var(--bs-body-color, #212529);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

/* Modal Header Layout */
.smartcrop-modal .modal-header,
.smartcrop-modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: var(--bs-tertiary-bg, #f8f9fa) !important;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6) !important;
    padding: 0.55rem 0.95rem !important;
    position: relative !important;
    gap: 0.5rem !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
}

.smartcrop-header-left {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 0 !important;
    justify-content: flex-start !important;
}

.smartcrop-header-center {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.4rem !important;
    flex: 0 0 auto !important;
}

.smartcrop-modal-title {
    font-weight: 600 !important;
    font-size: 0.92rem !important;
    color: var(--bs-body-color, #212529) !important;
    letter-spacing: 0.2px !important;
    line-height: 1.2 !important;
}

.smartcrop-header-right {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 0 !important;
    justify-content: flex-end !important;
    gap: 0.5rem !important;
}

/* Help (i) Button & Popover */
.smartcrop-help-wrapper {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
}

.smartcrop-modal .smartcrop-help-btn {
    border: none !important;
    background: transparent !important;
    color: #6c757d !important;
    padding: 2px 4px !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    box-shadow: none !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    border-radius: 50% !important;
    transition: color 0.15s ease, transform 0.15s ease !important;
}

.smartcrop-modal .smartcrop-help-btn:hover {
    color: #0d6efd !important;
    background: rgba(13, 110, 253, 0.08) !important;
    transform: scale(1.1) !important;
}

.smartcrop-help-popover {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 1050 !important;
    width: 280px !important;
    background: var(--bs-body-bg, #ffffff) !important;
    color: var(--bs-body-color, #212529) !important;
    border: 1px solid var(--bs-border-color, #dee2e6) !important;
    border-radius: 6px !important;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2) !important;
    padding: 10px 14px !important;
    font-size: 0.82rem !important;
    line-height: 1.45 !important;
    animation: smartcropFadeIn 0.15s ease !important;
}

.smartcrop-help-popover-title {
    font-weight: 600 !important;
    font-size: 0.84rem !important;
    margin-bottom: 6px !important;
    color: var(--bs-primary, #0d6efd) !important;
}

/* Complete immunity against Atum template modal button overrides */
.smartcrop-modal .btn,
.smartcrop-modal .modal-header .btn,
.smartcrop-modal .btn:not([href]) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    white-space: nowrap !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    padding: 0.35rem 0.7rem !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    border-radius: 4px !important;
    flex-shrink: 0 !important;
    text-decoration: none !important;
}

.smartcrop-modal .btn span,
.smartcrop-modal .btn [class^="icon-"],
.smartcrop-modal .btn [class*=" icon-"] {
    display: inline-block !important;
    background-color: transparent !important;
    color: inherit !important;
    block-size: auto !important;
    inline-size: auto !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    margin-inline-start: 0 !important;
    line-height: inherit !important;
}

.smartcrop-modal .smartcrop-btn-cancel {
    background: transparent !important;
    border: 1px solid #ced4da !important;
    color: #495057 !important;
}
.smartcrop-modal .smartcrop-btn-cancel:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
    color: #212529 !important;
}

.smartcrop-modal .smartcrop-btn-apply {
    background: #198754 !important;
    border: 1px solid #198754 !important;
    color: #ffffff !important;
}
.smartcrop-modal .smartcrop-btn-apply:hover {
    background: #157347 !important;
    border-color: #146c43 !important;
    color: #ffffff !important;
}

.smartcrop-modal .smartcrop-btn-remove {
    background: transparent !important;
    border: 1px solid #dc3545 !important;
    color: #dc3545 !important;
}
.smartcrop-modal .smartcrop-btn-remove:hover {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

/* Viewport Darkroom Container */
.smartcrop-viewport-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    background: #0d1117;
    border-radius: 8px;
    border: 1px solid #30363d;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    padding: 14px;
}

.smartcrop-viewport {
    position: relative;
    width: 100%;
    max-width: var(--smartcrop-max-width, 480px);
    overflow: hidden;
    background: #161b22;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.smartcrop-viewport.is-dragging {
    cursor: grabbing;
}

.smartcrop-image {
    position: absolute;
    top: 0;
    left: 0;
    max-width: none !important;
    max-height: none !important;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    will-change: transform;
    transform-origin: 0 0;
}

/* Camera Viewfinder Corner Reticles */
.smartcrop-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    pointer-events: none;
    z-index: 4;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
}

.smartcrop-corner.tl {
    top: 8px;
    left: 8px;
    border-top: 2.5px solid #ffffff;
    border-left: 2.5px solid #ffffff;
}

.smartcrop-corner.tr {
    top: 8px;
    right: 8px;
    border-top: 2.5px solid #ffffff;
    border-right: 2.5px solid #ffffff;
}

.smartcrop-corner.bl {
    bottom: 8px;
    left: 8px;
    border-bottom: 2.5px solid #ffffff;
    border-left: 2.5px solid #ffffff;
}

.smartcrop-corner.br {
    bottom: 8px;
    right: 8px;
    border-bottom: 2.5px solid #ffffff;
    border-right: 2.5px solid #ffffff;
}

/* Viewfinder Overlay Badge & HUD Dropdown */
.smartcrop-viewfinder-badge {
    position: absolute;
    top: 10px;
    left: 28px;
    background: rgba(0, 0, 0, 0.75);
    color: #f0f6fc;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 10;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    user-select: none;
    outline: none;
    line-height: inherit;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.smartcrop-viewfinder-badge:hover {
    background: rgba(22, 27, 34, 0.95);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transform: translateY(-1px);
}

.smartcrop-viewfinder-badge .smartcrop-caret {
    font-size: 0.65rem;
    opacity: 0.85;
    margin-left: 2px;
}

.smartcrop-ratio-dropdown {
    position: absolute;
    top: 38px;
    left: 28px;
    z-index: 1050;
    min-width: 220px;
    background: rgba(13, 17, 23, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    padding: 4px;
    user-select: none;
    animation: smartcropFadeIn 0.15s ease;
}

/* Center Image Button */
.smartcrop-btn-center {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.smartcrop-btn-center:hover {
    background-color: var(--bs-primary, #0d6efd) !important;
    border-color: var(--bs-primary, #0d6efd) !important;
    color: #ffffff !important;
}

.smartcrop-ratio-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #c9d1d9;
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.smartcrop-ratio-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.smartcrop-ratio-item.is-active {
    background: rgba(56, 139, 253, 0.25);
    color: #58a6ff;
    font-weight: 600;
}

.smartcrop-ratio-check {
    width: 18px;
    font-size: 0.85rem;
    color: #3fb950;
    font-weight: bold;
}

.smartcrop-ratio-val {
    font-family: monospace;
    font-weight: 600;
    font-size: 0.75rem;
    color: #8b949e;
    margin-right: 8px;
    min-width: 32px;
}

.smartcrop-ratio-item.is-active .smartcrop-ratio-val {
    color: #79c0ff;
}

.smartcrop-ratio-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smartcrop-ratio-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
    margin: 4px 0;
}

/* Rule of Thirds Guide Grid */
.smartcrop-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
    transition: opacity 0.2s ease;
    z-index: 3;
}

.smartcrop-viewport:hover .smartcrop-grid,
.smartcrop-viewport.is-dragging .smartcrop-grid {
    opacity: 0.65;
}

.smartcrop-grid-line {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.65);
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.8);
}

.smartcrop-grid-line.v1 {
    top: 0;
    bottom: 0;
    left: 33.3333%;
    width: 1px;
}

.smartcrop-grid-line.v2 {
    top: 0;
    bottom: 0;
    left: 66.6666%;
    width: 1px;
}

.smartcrop-grid-line.h1 {
    left: 0;
    right: 0;
    top: 33.3333%;
    height: 1px;
}

.smartcrop-grid-line.h2 {
    left: 0;
    right: 0;
    top: 66.6666%;
    height: 1px;
}

/* Floating Pan Hint Pill */
.smartcrop-pan-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 110, 253, 0.9);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.4s ease, transform 0.4s ease;
    white-space: nowrap;
    animation: smartcrop-hint-pulse 2.2s infinite ease-in-out;
}

.smartcrop-pan-hint.is-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
    pointer-events: none;
}

@keyframes smartcrop-hint-pulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.04);
        background: rgba(11, 94, 215, 0.96);
    }
}

/* Empty State */
.smartcrop-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 27, 34, 0.95);
    color: #c9d1d9;
    z-index: 6;
    padding: 1rem;
    text-align: center;
}

.smartcrop-empty-state .icon-picture {
    font-size: 2.5rem;
    opacity: 0.5;
}

/* Toolbar Controls inside Modal (Compact single-line) */
.smartcrop-toolbar {
    background: var(--bs-tertiary-bg, #f8f9fa);
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.smartcrop-zoom-controls {
    flex: 1 1 auto;
    max-width: 380px;
}

.smartcrop-zoom-slider {
    cursor: pointer;
    flex: 1;
}

/* Tick marks styling on range slider */
.smartcrop-zoom-slider::-webkit-slider-runnable-track {
    background-image: repeating-linear-gradient(to right, #ccc 0, #ccc 2px, transparent 0, transparent 25%);
}

.smartcrop-zoom-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* Discreet Coordinates */
.smartcrop-live-coords-discreet {
    user-select: none;
    line-height: 1;
}

.smartcrop-live-coords-discreet small {
    letter-spacing: 0.2px;
}

@media (max-width: 576px) {
    .smartcrop-toolbar {
        flex-wrap: wrap;
    }

    .smartcrop-zoom-controls {
        max-width: 100%;
    }
}
