/* Framing Studio UI */
.i2c-framing-studio {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.i2c-framing-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through if needed, or auto to block */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
    /* STRICT containment */
}

/* Conflict Resolution: Hide Original Image & Remove from Flow */
/* Conflict Resolution: Hide Original Image & Remove from Flow */
/* Conflict Resolution: Hide Original Image & Remove from Flow */
/* Conflict Resolution: Hide Original Image & Remove from Flow */
/* Simulating "No Image" state by hiding the inner wrapper entirely */
/* Conflict Resolution: Phantom Image Strategy */
/* We keep the image physically in the layout (display: block) but invisible */
/* This forces the container to naturally match the image's dimensions */
.i2c-canvas-active .woocommerce-product-gallery__wrapper {
    display: block !important;
    position: relative;
    z-index: 1;
    /* Behind canvas */
}

.i2c-canvas-active img,
.i2c-canvas-active .wp-post-image,
.i2c-canvas-active .woocommerce-product-gallery__trigger,
.i2c-canvas-active .zoomImg {
    display: block !important;
    /* Keep layout footprint for main image */
    visibility: hidden !important;
    /* Make invisible */
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Ensure the wrapper doesn't capture hover events for zoom */
.i2c-canvas-active .woocommerce-product-gallery__image {
    pointer-events: none !important;
}

/* Ensure container has transition for height changes */
.woocommerce-product-gallery__image,
.woocommerce-product-gallery__wrapper {
    transition: height 0.3s ease;
}

.i2c-framing-canvas-container.active {
    opacity: 1;
    pointer-events: auto;
}

.i2c-canvas {
    max-width: 100%;
    max-height: 100%;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.i2c-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    background: #fff;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
}

.i2c-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.i2c-control-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.i2c-frame-selector,
.i2c-mat-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.i2c-option-thumb {
    width: 50px;
    height: 50px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    transition: all 0.2s ease;
}

.i2c-option-thumb:hover {
    border-color: #999;
    transform: translateY(-2px);
}

.i2c-option-thumb.active {
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.3);
}

.i2c-range-input {
    width: 100%;
}

.i2c-color-picker {
    display: flex;
    gap: 5px;
}

.i2c-color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ddd;
    cursor: pointer;
}

.i2c-color-swatch.active {
    box-shadow: 0 0 0 2px #007cba;
}

/* Responsive */
@media (max-width: 600px) {
    .i2c-framing-canvas-container {
        height: 350px;
    }
}

/* Crop Modal */
#i2c-crop-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    justify-content: center;
    align-items: center;
}

#i2c-crop-modal .i2c-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#i2c-crop-modal h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

#i2c-crop-container {
    max-width: 800px;
    max-height: 600px;
    overflow: hidden;
    background: #333;
}

#i2c-crop-image {
    max-width: 100%;
    display: block;
}

#i2c-crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.i2c-orientation-btn.active {
    background-color: #007cba;
    color: #fff;
    border-color: #007cba;
}