/* Image Behind Image  additions on top of app.css */
.ibi-root { padding-top: 1rem; padding-bottom: 3rem; }

.ibi-info-list { list-style: none; padding: 0; margin: 1rem 1rem 0; text-align: left; }
.ibi-info-list li { padding: .5rem 0 .5rem 1.5rem; position: relative; color: #4b5563; font-size: .95rem; line-height: 1.5; }
.ibi-info-list li::before { content: ""; position: absolute; left: 0; top: .85rem; width: 8px; height: 8px; border-radius: 50%; background-image: linear-gradient(to right, var(--gradient-primary), var(--gradient-secondary)); }

.workspace.ibi-workspace { display: none; }
.workspace.ibi-workspace.ibi-open { display: block; }

.ibi-image-section {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 400px; position: relative;
}
.ibi-canvas-wrap { display: inline-block; max-width: 100%; position: relative; }
.ibi-canvas { position: relative; line-height: 0; box-shadow: 0 6px 18px rgba(0,0,0,.08); border-radius: 6px; overflow: hidden; background: #fff; display: inline-block; }
.ibi-original { position: relative; display: block; max-width: 100%; max-height: 65vh; width: auto; height: auto; z-index: 0; }
.ibi-original:not([src]) { display: none; }
.ibi-middle-layers { position: absolute; inset: 0; z-index: 1; }
.ibi-subject { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.ibi-subject:not([src]) { display: none; }

.ibi-loading { position: absolute; inset: 0; background: rgba(255,255,255,.85); display: flex; align-items: center; justify-content: center; z-index: 5; }
.ibi-loading[hidden] { display: none; }
.ibi-loading .progressive-loader { margin: 0; }
.ibi-hint { font-size: .8rem; color: #6a7280; }

/* Middle image layer */
.ibi-layer { position: absolute; touch-action: none; cursor: move; will-change: transform; }
.ibi-layer > .ibi-layer-inner { width: 100%; height: 100%; background-size: cover; background-position: center; background-repeat: no-repeat; display: block; }
.ibi-layer.ibi-selected { outline: 2px solid var(--gradient-primary); outline-offset: 0; }
.ibi-handle { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--gradient-primary); border-radius: 50%; display: none; z-index: 3; }
.ibi-layer.ibi-selected .ibi-handle { display: block; }
.ibi-handle.ibi-h-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.ibi-handle.ibi-h-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.ibi-handle.ibi-h-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.ibi-handle.ibi-h-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.ibi-handle.ibi-h-rot { top: -30px; left: 50%; transform: translateX(-50%); cursor: grab; background: var(--gradient-primary); border-color: #fff; }
.ibi-handle.ibi-h-rot::after { content: ""; position: absolute; left: 50%; top: 12px; width: 1px; height: 15px; background: var(--gradient-primary); transform: translateX(-50%); }

/* Right panel */
.ibi-options { min-height: 500px; }

.ibi-tabs .button { padding: 8px 4px; font-size: 12px; flex-direction: column; gap: 2px; }
.ibi-tabs .button svg { height: 16px; width: 16px; margin-right: 0; }
.ibi-tabs .button span { font-size: 11px; }
.ibi-tabs :nth-child(3) { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }

.ibi-panel-hint { color: #6a7280; font-size: .85rem; margin-bottom: .75rem; }

.ibi-preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.ibi-preset { aspect-ratio: 1/1; border: 2px solid #e4e7eb; border-radius: 10px; cursor: pointer; padding: 0; background-size: cover; background-position: center; transition: transform .15s ease; }
.ibi-preset:hover { transform: scale(1.05); }

.ibi-search-row { display: flex; gap: .5rem; margin-bottom: .75rem; }
.ibi-search-input { flex: 1 1 auto; margin-bottom: 0 !important; }
.ibi-search-row .btn-style { padding: 8px 14px; }
.ibi-pexels-status { font-size: .8rem; color: #6a7280; margin-bottom: .5rem; min-height: 1em; }
.ibi-pexels-status.ibi-error { color: #b42318; }
.ibi-pexels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; max-height: 280px; overflow-y: auto; padding-right: 4px; }
.ibi-pexels-grid button { aspect-ratio: 1/1; border: 2px solid #e4e7eb; border-radius: 8px; cursor: pointer; padding: 0; overflow: hidden; background: #f4f4f5; }
.ibi-pexels-grid button:hover { border-color: var(--gradient-primary); }
.ibi-pexels-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ibi-pexels-credit { font-size: .7rem; color: #8892a3; margin-top: .5rem; margin-bottom: 0; text-align: right; }
.ibi-pexels-credit a { color: #6557ff; text-decoration: none; }

.ibi-props { background: #fff; border: 1px solid #e4e7eb; border-radius: 10px; padding: 12px 14px; }
.ibi-props .ep-header { padding: 0 0 8px; }
.ibi-props .ep-title { font-size: 12px; font-weight: 700; letter-spacing: .05em; color: #55606f; }
.ibi-props .option-label { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; margin-bottom: 6px; }
.ibi-num { font-size: .8rem; color: #222b3a; font-weight: 600; }
.ibi-mini-row { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.ibi-mini { font-size: .82rem; padding: 8px 12px; width: 100%; }
.ibi-mini-danger { background: #b42318 !important; }

.ibi-download-block .editor-panel { border: 1px solid #e4e7eb; border-radius: 10px; padding: 12px 14px; background: #fff; }
.ibi-download-block .ep-header { padding: 0 0 8px; }
.ibi-download-block .ep-title { font-size: 12px; font-weight: 700; letter-spacing: .05em; color: #55606f; }
.ibi-fmt-tabs { margin-top: .5rem; }
.ibi-fmt-tabs :nth-child(3) { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
.ibi-reset-btn { width: 100%; }

@media (max-width: 767px) {
  .ibi-image-section { min-height: 320px; padding: 12px !important; }
}
