/* Givia Targeting Image System */

.givia-targeting-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.givia-targeting-image-inner {
    position: relative;
    width: 100%;
    min-height: 300px; /* Default height */
    overflow: hidden; /* Prevent bleed */
}
.givia-targeting-image-inner .givia-targeting-link.trigger-type-whole.universal-trigger-btn:hover {
    background: inherit !important;
}
.givia-targeting-image-editor-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px dashed #2271b1;
    background: #f8fbff;
}

.givia-targeting-imgs {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
}

.givia-targeting-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    z-index: 1;
}

.givia-targeting-item.is-active {
    opacity: 1;
    z-index: 2;
}

.givia-targeting-item img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    display: block;
}

/* Action pointer if lightbox/modal */
.givia-targeting-item[data-action="lightbox"],
.givia-targeting-item[data-action="modal"] {
    cursor: pointer;
}

.givia-targeting-item[data-action="lightbox"]:hover img,
.givia-targeting-item[data-action="modal"]:hover img {
    filter: brightness(0.9);
}

/* Trigger elements style */
[data-givia-targeting-id] {
    cursor: pointer;
    transition: all 0.3s ease;
}

[data-givia-targeting-id].is-active {
    outline: none !important;
    box-shadow: none !important;
}

/* Action pointer if link/lightbox/modal */
.givia-targeting-item[data-action="link"],
.givia-targeting-item[data-action="lightbox"],
.givia-targeting-item[data-action="modal"] {
    cursor: pointer;
}

/* Action Button Styles */
.givia-targeting-button-wrapper {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to the link wrapper */
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.givia-targeting-item.is-active .givia-targeting-button-wrapper {
    opacity: 1;
    transform: translateY(0);
}

.givia-targeting-btn {
    display: inline-block;
    padding: 10px 24px;
    background: #2271b1;
    color: #fff;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(34, 113, 177, 0.3);
    transition: all 0.3s ease;
}

.givia-targeting-item:hover .givia-targeting-btn {
    background: #135e96;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(34, 113, 177, 0.4);
}

.givia-targeting-link {
    text-decoration: none !important;
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 5;
}

.givia-targeting-link.trigger-type-whole {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 15;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.givia-targeting-link.trigger-type-whole:hover {
    background: transparent !important;
    transform: none !important;
}

/* [v17.4] Global Trigger Button Overrides (Only for Inline Buttons) */
.givia-targeting-link.trigger-type-button.universal-trigger-btn {
    /* Existing global styles will apply here if they use .universal-trigger-btn */
}

/* [v17.4] Inline Modal Editor Styles */
.givia-targeting-item-editor.is-modal-editing {
    border: 2px solid #2271b1;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
}

.givia-inline-modal-editor-wrapper {
    background: #fff;
    min-height: 200px;
}

.modal-editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f0f7ff;
    border-bottom: 1px solid #c2dcfb;
    margin: -20px -20px 20px -20px;
    border-radius: 6px 6px 0 0;
}

/* [v17.4] Editor Specific Overrides */
.editor-styles-wrapper .givia-targeting-engine-notice {
    background: #007cba !important;
    color: #fff !important;
    padding: 10px 15px !important;
    border-radius: 4px 4px 0 0 !important;
    margin-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    border: none !important;
}

.editor-styles-wrapper .givia-targeting-engine-notice strong {
    color: #fff !important;
    margin: 0 !important;
}

.editor-styles-wrapper .targeting-item-preview {
    border: 1px solid #007cba !important;
    border-top: none !important;
    background: #fff !important;
    padding: 15px !important;
    border-radius: 0 0 4px 4px !important;
}

.preview-panes-container {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

/* Premium Orange Button */
.givia-btn-premium-orange {
    background: #f97316 !important;
    border-color: #f97316 !important;
    color: #fff !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.2) !important;
}

.givia-btn-premium-orange:hover {
    background: #ea580c !important;
    border-color: #ea580c !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 6px rgba(249, 115, 22, 0.3) !important;
}

.givia-btn-premium-orange:active {
    transform: translateY(0) !important;
}

.givia-targeting-engine-notice strong {
    font-size: 14px;
    color: #fff;
    display: inline-block;
    margin-right: 5px;
}

.givia-targeting-engine-notice span {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    font-family: inherit;
}

.engine-status-badge {
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    margin-left: auto;
}

/* Updated Preview Panes */
.targeting-item-preview {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
}

.preview-pane {
    flex: 1;
    min-width: 0; /* Important for flex child wrapping */
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.preview-pane span {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    z-index: 2;
}

.preview-pane img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.preview-pane .placeholder {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 11px;
    text-align: center;
    padding: 0 5px;
    line-height: 1.2;
}

/* Device Tabs UI */
.givia-device-tabs .components-tab-panel__tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.givia-device-tabs .components-button {
    flex: 1;
    justify-content: center;
    padding: 8px !important;
    height: auto !important;
}

.givia-device-tabs .is-active {
    background: #2271b1 !important;
    color: #fff !important;
    border-radius: 4px 4px 0 0;
}

@media (max-width: 768px) {
    .givia-targeting-image-inner {
        min-height: 200px;
    }
}
