/* Office Templates Builder - Premium UI */

/* Variables */
:root {
    --otb-nav-bg: #0e1318;
    --otb-nav-text: #fff;
    --otb-nav-width: 72px;
    --otb-drawer-bg: #252627;
    --otb-drawer-text: #fff;
    --otb-drawer-width: 340px;
    --otb-toolbar-bg: #fff;
    --otb-canvas-bg: #f1f2f6;
    --otb-accent: #8b3dff;
    /* Canva-like purple */
    --otb-text: #0d1216;
}

/* ============================================================
   OTB PRECISION CSS ISOLATION RESET
   ============================================================ */

/* 1. Global box-model + baseline inside the plugin.
      We reset margin/padding/line-height/min-height to 0/normal
      to prevent theme "leakage" without wiping out display properties. */
#otb-app,
#otb-frontend-app,
#otb-app *:not(i):not(span):not(.dashicons):not(.lucide),
#otb-frontend-app *:not(i):not(span):not(.dashicons):not(.lucide) {
    box-sizing: border-box !important;
    line-height: normal !important;
    text-transform: none !important;
    text-shadow: none !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

/* 1.1 Special Protection for Icons */
#otb-app i,
#otb-frontend-app i,
#otb-app span.dashicons,
#otb-frontend-app span.dashicons,
#otb-app svg.lucide,
#otb-frontend-app svg.lucide {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
    line-height: 1 !important;
}

/* 2. Button & Interactive Cleans 
      We do NOT use 'all: unset' because it's too destructive.
      Instead, we surgically zero out common theme overrides. */
#otb-app input:not([type="color"]):not([type="range"]),
#otb-app select,
#otb-app textarea {
    margin: 0 !important;
    padding: 6px 10px !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
    box-shadow: none !important;
    line-height: normal !important;
    font-family: inherit !important;
    font-size: 13px !important;
    color: #333 !important;
    min-height: 34px !important;
    max-height: none !important;
    min-width: 0 !important;
    appearance: auto !important;
    -webkit-appearance: auto !important;
    border-radius: 4px !important;
    transition: border-color 0.2s;
}

#otb-app input[type="color"] {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    min-height: 30px !important;
}

#otb-app button {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    line-height: normal !important;
    font-family: inherit !important;
    font-size: inherit !important;
    color: inherit !important;
    min-height: 0 !important;
    max-height: none !important;
    min-width: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    border-radius: 0 !important;
}

#otb-app button {
    cursor: pointer !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* 3. Typography & Lists */
#otb-app ul,
#otb-app ol,
#otb-app li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

#otb-app h1,
#otb-app h2,
#otb-app h3,
#otb-app h4,
#otb-app h5,
#otb-app p {
    margin: 0 !important;
    padding: 0 !important;
    font-weight: normal;
    font-size: 1rem;
    line-height: normal !important;
}

#otb-app label {
    display: inline-block;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: normal !important;
}

/* ============================================================
   END OF PRECISION RESET
   ============================================================ */


#otb-app.otb-fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background-color: var(--otb-bg-light, #f8f9fa);
    margin: 0 !important;
    padding: 0 !important;
}

.otb-app-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    height: 100%;
    /* Changed from 100vh to fill parent */
    max-height: 100%;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--otb-text);
    background: var(--otb-canvas-bg);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease-in-out;
}

/* Default height when NOT in a constrained parent like the overlay */
#otb-app,
#otb-frontend-app {
    height: 90vh;
    min-height: 600px;
    width: 100%;
    position: relative;
}

.otb-app-container.collapsed .otb-sidebar-drawer {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.otb-app-container.collapsed .otb-sidebar-nav {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Fix for WP Admin Bar */
body.admin-bar .otb-app-container {
    height: calc(100vh - 32px);
    /* margin-top: 32px; */
    /* Usually WP handles the body margin, but we ensure height fits */
}

@media screen and (max-width: 782px) {
    body.admin-bar .otb-app-container {
        height: calc(100vh - 46px);
        /* margin-top: 46px; */
    }
}

/* Launch Button Styles */
.otb-launch-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

/* Style 1: Fancy (Vibrant Gradient) */
.otb-launch-btn.style-1 {
    color: #fff;
    background: linear-gradient(135deg, #8b3dff, #6c2bd9);
    box-shadow: 0 4px 15px rgba(139, 61, 255, 0.3);
}

.otb-launch-btn.style-1:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 61, 255, 0.4);
    filter: brightness(1.1);
}

/* Style 2: Plain (Clean White / Bordered) */
.otb-launch-btn.style-2 {
    color: #1d1d1f;
    background: #fff;
    border: 1px solid #d2d2d7;
}

.otb-launch-btn.style-2:hover {
    background: #f5f5f7;
    border-color: #86868b;
}

/* Style 3: Professional (Solid Dark) */
.otb-launch-btn.style-3 {
    color: #fff;
    background: #1d1d1f;
}

.otb-launch-btn.style-3:hover {
    background: #000;
}

/* Style 4: Sober (Minimalist Light Grey) */
.otb-launch-btn.style-4 {
    color: #515154;
    background: #f5f5f7;
}

.otb-launch-btn.style-4:hover {
    background: #e8e8ed;
    color: #1d1d1f;
}

/* Style 5: Decent (Modern Flat Blue) */
.otb-launch-btn.style-5 {
    color: #fff;
    background: #0071e3;
}

.otb-launch-btn.style-5:hover {
    background: #0077ed;
}

/* Button Sizes */
.otb-launch-btn.size-small {
    padding: 8px 18px;
    font-size: 13px;
    border-radius: 6px;
}

.otb-launch-btn.size-small i {
    width: 16px !important;
    height: 16px !important;
}

.otb-launch-btn.size-medium {
    padding: 12px 28px;
    font-size: 15px;
    border-radius: 8px;
}

.otb-launch-btn.size-large {
    padding: 18px 42px;
    font-size: 18px;
    border-radius: 12px;
}

.otb-launch-btn.size-large i {
    width: 24px !important;
    height: 24px !important;
}

.otb-launch-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Admin Hover Previews */
.otb-admin-preview-trigger {
    position: relative;
    display: inline-block;
    cursor: help;
}

.otb-admin-hover-preview {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    z-index: 999999;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 5px;
    border-radius: 8px;
    display: none;
    pointer-events: none;
    width: 250px;
}

.otb-admin-hover-preview img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.otb-admin-preview-trigger:hover .otb-admin-hover-preview {
    display: block;
}

/* Editor Overlay */
.otb-editor-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999995 !important;
    background: var(--otb-canvas-bg, #f1f2f6) !important;
    transition: all 0.3s ease;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.admin-bar .otb-editor-overlay {
    top: 32px !important;
}

/* Fix for mobile Chrome URL bar jumping */
@media screen and (max-width: 600px) {
    #otb-editor-overlay {
        height: -webkit-fill-available;
    }
}

@media screen and (max-width: 782px) {
    body.admin-bar .otb-editor-overlay {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

.otb-editor-overlay #otb-frontend-app {
    height: 100% !important;
    width: 100% !important;
    display: block !important;
}

.otb-editor-overlay .otb-app-container {
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
}

/* Minimized state - OBSOLETE */
.otb-editor-overlay.minimized {
    display: none !important;
}

.otb-editor-overlay.minimized .otb-window-controls {
    position: static;
    height: 48px;
    background: #1a1a2e;
    border-radius: 0;
    padding: 0 16px;
    box-shadow: none;
}

.otb-editor-overlay.minimized .otb-window-controls::before {
    content: '?? Template Editor';
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    margin-right: auto;
    display: flex;
    align-items: center;
}

/* Window Controls - BOTTOM RIGHT */
.otb-window-controls {
    position: absolute;
    bottom: 42px;
    right: 20px;
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 4px 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.otb-win-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.15s ease;
    padding: 0;
}

.otb-win-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.otb-win-btn .dashicons,
.otb-win-btn svg.lucide,
.otb-overlay-btn .dashicons,
.otb-overlay-btn svg.lucide {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    display: block;
}

.otb-win-close:hover {
    background: #e74c3c;
    color: #fff;
}

/* 1. Left Navigation Rail */
.otb-sidebar-nav {
    width: var(--otb-nav-width) !important;
    min-width: var(--otb-nav-width) !important;
    background: var(--otb-nav-bg) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding-top: 15px !important;
    z-index: 20;
    flex-shrink: 0 !important;
}

.otb-nav-item {
    width: 100%;
    height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center !important;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    font-weight: 500;
}

.otb-nav-item:hover,
.otb-nav-item.otb-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.otb-nav-item.otb-active {
    position: relative;
    background: var(--otb-drawer-bg);
}

.otb-nav-item.otb-active::after {
    content: '';
    /* Remove the colored bar, match background */
}

.otb-nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
    /* Use dashicons or svg */
}

/* 2. Drawer (Content) */
.otb-sidebar-drawer {
    width: var(--otb-drawer-width) !important;
    min-width: var(--otb-drawer-width) !important;
    background: var(--otb-drawer-bg) !important;
    color: var(--otb-drawer-text) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    z-index: 10;
    position: relative;
    transition: width 0.3s ease-in-out, min-width 0.3s ease-in-out, max-width 0.3s ease-in-out, opacity 0.3s ease-in-out, padding 0.3s ease-in-out, visibility 0.3s;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0 !important;
    overflow: hidden;
    will-change: width, opacity;
}

.otb-drawer-header {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}

#otb-app .otb-drawer-header h3,
#otb-app .otb-drawer-header h4 {
    margin: 0 !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 600 !important;
}

.otb-drawer-search {
    width: 100%;
    padding: 5px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    color: #fff;
    font-size: 0.9rem;
}

.otb-drawer-search:focus {
    border-color: var(--otb-accent);
    outline: none;
}

.otb-drawer-search option {
    background-color: var(--otb-drawer-bg);
    color: #fff;
}

.otb-drawer-content {
    flex: 1;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 15px 15px 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}

.otb-drawer-section {
    position: absolute;
    inset: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: flex-start !important;
    overflow: hidden;
    min-height: 0;
}

.otb-drawer-section.otb-active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Sticky Header for Search */
.otb-sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--otb-drawer-bg);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

/* Ensure padding-top on the content below so it isn't hidden */
#otb-svg-library-list {
    padding-top: 5px;
}

/* Grids for assets */
.otb-assets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    color: #000;
}

.otb-masonry-grid {
    column-count: 2;
    column-gap: 10px;
    width: 100%;
    line-height: 0;
}

.otb-template-item {
    break-inside: avoid;
    margin-bottom: 20px !important;
    width: 100%;
    display: block !important;
}

.otb-asset-item {
    margin-bottom: 10px !important;
}




.otb-asset-item {
    background: rgba(255, 255, 255, 0.80);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    padding: 3px;
}

/* Asset Group Layout */
.otb-asset-group {
    margin-bottom: 18px;
    width: 100%;
}

.otb-asset-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 5px;
}

.otb-asset-group-title {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    display: flex;
    align-items: center;
}

.otb-asset-count {
    opacity: 0.5;
    font-weight: 400;
    font-size: 11px;
    margin-left: 5px;
}

.otb-view-all-assets {
    background: none;
    border: none;
    font-size: 11px;
    color: #3b82f6;
    cursor: pointer;
    padding: 2px 0;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.1s;
}

.otb-view-all-assets:hover {
    color: #60a5fa;
}

.otb-asset-group-preview {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.otb-asset-group-expanded {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: rgba(0, 0, 0, 0.12);
    padding: 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.otb-asset-item:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.1);
}

.otb-pattern-active {
    outline: 2px solid var(--otb-accent) !important;
    outline-offset: -2px;
}

#otb-bg-patterns-list {
    grid-template-columns: repeat(3, 1fr) !important;
}

.otb-asset-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Scrollbar styling */
.otb-drawer-content::-webkit-scrollbar {
    width: 6px;
}

.otb-drawer-content::-webkit-scrollbar-track {
    background: transparent;
}

.otb-drawer-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.otb-drawer-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Canvas Loading Overlay */
.otb-canvas-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center !important;
    z-index: 50;
    border-radius: 2px;
    backdrop-filter: blur(2px);
}

.otb-canvas-loading .otb-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: otb-spin 0.8s linear infinite;
}

.otb-canvas-loading span {
    margin-top: 12px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

@keyframes otb-spin {
    to {
        transform: rotate(360deg);
    }
}

.otb-nav-toggle-icon {
    transition: transform 0.3s;
}

.otb-app-container.collapsed .otb-nav-toggle-icon {
    transform: rotate(180deg);
}

@keyframes rotation {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Infinite scroll loader */
.otb-scroll-loader {
    text-align: center;
    padding: 15px 0;
}

.otb-scroll-loader .otb-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--otb-accent);
    border-radius: 50%;
    animation: otb-spin 0.8s linear infinite;
    display: inline-block;
}

/* 3. Main Workspace */
.otb-workspace-area {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    min-width: 0 !important;
    position: relative;
    background: #f4f4f4;
}

.otb-main-view {
    display: flex !important;
    flex: 1 !important;
    flex-direction: row !important;
    overflow: hidden !important;
    position: relative !important;
}

.otb-canvas-section {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    min-width: 0 !important;
}


/* Top Toolbar */
.otb-toolbar {
    height: 60px;
    background: var(--otb-toolbar-bg);
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    /* Above rulers and canvas loading */
}

.otb-toolbar-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.otb-toolbar-btn {
    background: transparent;
    border: none;
    padding: 9px 10px;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    min-height: 36px;
}

.otb-toolbar-btn svg.lucide {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
    flex-shrink: 0;
}

.otb-orientation-btn {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    justify-content: center !important;
}

.otb-orientation-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.otb-toolbar-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.otb-toolbar-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.otb-toolbar-btn.otb-primary {
    background: var(--otb-accent);
    color: #fff;
    padding: 8px 16px;
}

.otb-toolbar-btn.otb-primary:hover {
    filter: brightness(1.1);
}

/* ===== Properties Bar (Right Inspector Panel) ===== */
.otb-properties-bar {
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    height: 100% !important;
    background: #fff !important;
    border-left: 1px solid #e0e0e0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 13px !important;
    box-sizing: border-box !important;
    z-index: 1000 !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s !important;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.08) !important;
}

.otb-properties-bar:not(.otb-active) {
    transform: translateX(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* --- Icon Grid Helper for Sidebar --- */
.otb-icon-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
    margin-top: 8px !important;
}

.otb-icon-grid .otb-icon-btn {
    width: 100% !important;
    height: 36px !important;
    justify-content: center !important;
    background: #f8f9fa !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    color: #444 !important;
}

.otb-icon-grid .otb-icon-btn:hover {
    background: #ebeeef !important;
    border-color: #d0d4d8 !important;
    color: #1a73e8 !important;
}

.otb-icon-grid .otb-icon-btn:active,
.otb-icon-grid .otb-icon-btn.active,
.otb-icon-grid .otb-icon-btn.otb-active {
    background: rgba(26, 115, 232, 0.08) !important;
    border-color: #1a73e8 !important;
    color: #1a73e8 !important;
}

.otb-properties-bar-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.otb-properties-bar-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.otb-prop-section {
    padding: 12px 14px;
    border-bottom: 1px solid #f2f2f2;
    width: 100%;
    box-sizing: border-box;
}

.otb-prop-section-title {
    font-size: 10px;
    font-weight: 700;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 8px;
    user-select: none;
}

/* ── New sidebar section wrapper ── */
.otb-sidebar-section {
    padding: 10px 14px 12px;
    border-bottom: 1px solid #f2f2f2;
    width: 100%;
    box-sizing: border-box;
}

.otb-sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #c0c0c0;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 8px;
    user-select: none;
}

/* Sidebar section separator — very light, provides rhythm without fragmenting */
.otb-prop-separator {
    height: 1px;
    width: 100%;
    background: #f2f2f2;
    margin: 2px 0;
    flex-shrink: 0;
    display: block;
    align-self: stretch;
}


/* -- Group -- */
.otb-prop-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    padding: 4px 0 !important;
    flex-shrink: 0 !important;
}

/* -- Pill Button (Font Picker, etc.) -- */
.otb-pill-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    padding: 5px 10px !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-family: inherit !important;
    color: #333 !important;
    white-space: nowrap !important;
    transition: border-color 0.15s, background 0.15s;
    height: 34px !important;
    box-sizing: border-box !important;
}

.otb-pill-btn:hover {
    border-color: #bbb;
    background: #fafafa;
}

.otb-pill-btn .otb-pill-arrow {
    font-size: 10px;
    color: #888;
    margin-left: 2px;
}

/* -- Font Size Stepper -- */
.otb-size-stepper {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    height: 34px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: #fff !important;
}

.otb-size-stepper button {
    width: 28px;
    height: 100%;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
    line-height: 1;
}

.otb-size-stepper button:hover {
    background: #f0f0f0;
}

.otb-size-stepper input {
    width: 38px;
    text-align: center;
    border: none;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
    font-size: 13px;
    font-family: inherit;
    color: #333;
    height: 100%;
    padding: 0;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
    box-sizing: border-box;
    background: #fff;
}

.otb-size-stepper input::-webkit-outer-spin-button,
.otb-size-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* -- Icon Button (B, I, U, etc.) -- */
.otb-icon-btn {
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    color: #555 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 !important;
    font-size: 13px !important;
    position: relative !important;
}

.otb-icon-btn:hover {
    background: #f1f3f4;
    color: #1a73e8;
}

.otb-icon-btn.otb-active {
    background: rgba(26, 115, 232, 0.1) !important;
    color: #1a73e8 !important;
}

.otb-icon-btn .dashicons,
.otb-icon-btn svg.lucide {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    display: block;
}

/* -- Property Groups (canonical definition) -- */
.otb-prop-group {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    padding: 4px 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    flex-shrink: 0 !important;
}

.otb-prop-group-right {
    border-top: 1px solid #f2f2f2;
    padding-top: 6px;
    margin-top: 0;
}


.otb-prop-label {
    font-size: 11px;
    font-weight: 600;
    color: #777;
    margin-right: 4px;
}

/* -- Color Swatch Button -- */
.otb-color-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    position: relative;
}

.otb-color-btn:hover {
    background: #f0f0f0;
}

.otb-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    display: block;
}

.otb-color-btn input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
}

/* -- Inline Select (Align) -- */
.otb-inline-select {
    height: 34px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 12px;
    font-family: inherit;
    color: #333;
    background: #fff;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.otb-inline-select:hover {
    border-color: #bbb;
}

/* -- Font Dropdown List -- */
.otb-font-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 200px;
    overflow: visible;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 2147483647 !important;
    border-radius: 8px;
    padding: 0;
}

.otb-font-search-container {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 10px;
    border-bottom: 1px solid #eee;
    z-index: 10;
}

.otb-font-search-input {
    width: 100%;
    height: 32px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.otb-font-search-input:focus {
    border-color: var(--otb-accent, #2d7ff9);
}

.otb-font-dropdown-item {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.1s;
    white-space: nowrap;
}

.otb-font-dropdown-item:hover {
    background: #f5f5f5;
}

.otb-font-dropdown-item.otb-selected {
    background: #eef2ff;
    font-weight: normal;
}

/* -- Opacity Slider -- */
.otb-opacity-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: #ddd;
    outline: none;
}

.otb-opacity-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #555;
    cursor: pointer;
}

/* -- Toolbar Popovers (Shadow, Formatting, Align, Export) -- */
.otb-toolbar-popover {
    display: none;
    position: absolute;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    z-index: 2147483647 !important;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    user-select: none;
}

.otb-toolbar-popover-content {
    padding: 14px;
}

.otb-popover-header {
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
}

.otb-popover-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #777;
    letter-spacing: 0.5px;
}

.otb-popover-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.otb-popover-close:hover {
    background: #eee;
    color: #333;
}

.otb-toolbar-popover.right-align {
    left: auto;
    right: 0;
    transform: none;
}

.otb-toolbar-popover.otb-active {
    display: block;
}

/* -- Export Popover: fully replaced with dedicated export menu system -- */

/* ─── Export trigger button ─────────────────────────────────────────────── */
.otb-export-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.otb-export-trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    border: 1px solid #e0e0e0 !important;
    background: #fff !important;
    color: #333 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: background 0.15s, border-color 0.15s !important;
    line-height: 1.2 !important;
    height: 34px !important;
    box-sizing: border-box !important;
}

.otb-export-trigger:hover,
.otb-export-trigger.otb-active {
    background: #f5f5f5 !important;
    border-color: #bbb !important;
}

.otb-export-trigger-label {
    font-size: 12px;
    font-weight: 600;
    color: #444;
}

.otb-export-chevron {
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.otb-export-trigger.otb-active .otb-export-chevron {
    transform: rotate(180deg);
}

/* ─── Export menu (dropdown) ─────────────────────────────────────────────── */
.otb-export-menu {
    display: none;
    position: fixed;
    background: #fff;
    border: 1px solid #e4e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    z-index: 2147483647;
    padding: 6px 0;
    min-width: 200px;
    /* No width here — set by JS */
}

.otb-export-menu.otb-export-menu--open {
    display: block;
}

.otb-export-menu-header {
    font-size: 10px;
    font-weight: 700;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 6px 14px 4px;
    user-select: none;
}

/* ─── Export menu items ──────────────────────────────────────────────────── */
.otb-export-menu .otb-export-opt {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 8px 14px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    text-align: left !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transition: background 0.12s ease !important;
    line-height: 1.3 !important;
    min-height: 0 !important;
    height: auto !important;
    float: none !important;
    position: static !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.otb-export-menu .otb-export-opt:hover {
    background: #f0f4f8 !important;
}

.otb-export-opt-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #f4f6f8;
    border-radius: 6px;
    flex-shrink: 0;
    color: #555;
}

.otb-export-opt-icon svg,
.otb-export-opt-icon i[data-lucide] {
    width: 14px !important;
    height: 14px !important;
    display: block !important;
}

.otb-export-opt-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.otb-export-opt-name {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #222 !important;
    line-height: 1.3 !important;
    display: block !important;
}

.otb-export-opt-desc {
    font-size: 10px !important;
    color: #999 !important;
    line-height: 1.3 !important;
    display: block !important;
    font-weight: 400 !important;
}

/* Divider between items */
.otb-export-menu .otb-export-opt+.otb-export-opt {
    border-top: 1px solid #f2f2f2 !important;
}

.otb-toolbar-popover label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.otb-toolbar-popover input[type="number"] {
    width: 100%;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 6px;
    font-size: 12px;
    box-sizing: border-box;
    outline: none;
}

.otb-toolbar-popover input[type="range"] {
    width: 100%;
    height: 4px;
}

/* -- Actions Group (right-aligned) -- */
.otb-actions-group {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

/* -- Label Text -- */
.otb-bar-label {
    font-size: 13px;
    color: #555;
    font-weight: 500;
    white-space: nowrap;
}

.otb-prop-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.otb-prop-color {
    width: 28px;
    height: 28px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
    -webkit-appearance: none;
    appearance: none;
}

.otb-prop-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.otb-prop-color::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.otb-prop-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.otb-prop-input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    height: 32px;
    font-size: 13px;
    color: #333;
}

.otb-toolbar-btn.otb-active {
    background: #e6e6e6;
    color: #000;
}

/* Canvas Area */
.otb-canvas-container {
    flex: 1;
    background: var(--otb-canvas-bg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    position: relative;
    padding: 40px 60px;
    min-height: 0;
}

.canvas-container {
    /* FabricJS wrapper */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Bottom Bar: Pages + Zoom */
.otb-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 0 16px;
    flex-shrink: 0;
}

/* Page Tabs */
.otb-page-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    max-width: 60%;
}

.otb-page-tab {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    user-select: none;
}

.otb-page-tab:hover {
    background: #f0f0f0;
    color: #333;
}

.otb-page-tab.otb-active {
    background: var(--otb-accent, #8b3dff);
    color: #fff;
    border-color: var(--otb-accent, #8b3dff);
}

/* Page Hover Preview */
.otb-page-preview {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 160px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.otb-page-preview.otb-active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.otb-page-preview::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
}

.otb-page-preview-thumb {
    width: 100%;
    aspect-ratio: 1 / 1.414;
    background-color: #fff;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.otb-page-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.otb-page-preview-label {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-top: 6px;
}

.otb-page-add {
    width: 28px;
    height: 28px;
    border: 1px dashed #ccc;
    border-radius: 6px;
    background: transparent;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.otb-page-add:hover {
    border-color: var(--otb-accent, #8b3dff);
    color: var(--otb-accent, #8b3dff);
    background: rgba(139, 61, 255, 0.05);
}

/* Zoom Controls (inside bottom bar) */
.otb-zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    flex-shrink: 0;
}

.otb-zoom-controls .dashicons,
.otb-zoom-controls svg.lucide {
    cursor: pointer;
    color: #666;
    transition: color 0.15s;
}

.otb-zoom-controls .dashicons:hover,
.otb-zoom-controls svg.lucide:hover {
    color: var(--otb-accent, #8b3dff);
}

.otb-zoom-input {
    width: 45px;
    height: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #f8f9fa;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    padding: 0;
    outline: none;
    transition: all 0.2s ease;
}

.otb-zoom-input:focus {
    border-color: var(--otb-accent, #8b3dff);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(139, 61, 255, 0.1);
}

/* Loading */
.otb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
}

/* Tool Button (Text) */
.otb-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: #fff;
    background: var(--otb-primary, #2d7ff9);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.otb-tool-btn:hover {
    background: var(--otb-primary-dark, #1c5fcc);
    transform: translateY(-1px);
}

.otb-tool-btn:active {
    transform: translateY(0);
}

/* Slider styling — targets .otb-range class AND all range inputs within the editor */
.otb-range,
#otb-app input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(139, 61, 255, 0.3);
    border: none;
    border-radius: 2px;
    outline: none;
    opacity: 0.9;
    transition: opacity .2s;
}

.otb-range:hover,
#otb-app input[type="range"]:hover {
    opacity: 1;
}

.otb-range::-webkit-slider-thumb,
#otb-app input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--otb-accent, #8b3dff);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform .15s ease;
}

.otb-range::-webkit-slider-thumb:hover,
#otb-app input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.otb-range::-moz-range-thumb,
#otb-app input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--otb-accent, #8b3dff);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.otb-range::-moz-range-track,
#otb-app input[type="range"]::-moz-range-track {
    height: 4px;
    background: rgba(139, 61, 255, 0.3);
    border: none;
    border-radius: 2px;
}


/* Red / Danger Button */
.otb-tool-btn.otb-btn-danger,
.otb-tool-btn.otb-btn-danger:hover {
    color: #f44336;
    border-color: #ffcdd2;
}

/* --- Template Library --- */
.otb-toolbar-btn.otb-primary {
    background: var(--otb-accent, #8b3dff);
    color: #fff !important;
    border: none;
    padding: 16px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.otb-toolbar-btn.otb-primary:hover {
    background: #7a2df2;
    color: #fff !important;
    transform: scale(1.05);
}

.otb-template-overlay-title {
    color: #fff;
    font-size: 11px;
    margin-top: 10px;
    text-align: center;
    padding: 0 10px;
    line-height: 1.3;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

/* --- Custom Modal System --- */
.otb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.otb-modal-overlay.otb-active {
    opacity: 1;
}

.otb-modal-box {
    background: #fff;
    width: 400px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 24px;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.otb-modal-overlay.otb-active .otb-modal-box {
    transform: translateY(0);
}

.otb-modal-icon {
    font-size: 40px;
    color: var(--otb-accent, #8b3dff);
    margin-bottom: 16px;
    display: block;
}

.otb-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin-bottom: 12px;
}

.otb-modal-msg {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 24px;
}

.otb-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.otb-modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
}

.otb-modal-btn:hover {
    background: #f5f5f5;
}

.otb-modal-btn.otb-primary {
    background: var(--otb-accent, #8b3dff);
    color: #fff;
    border: none;
}

.otb-modal-btn.otb-primary:hover {
    background: #7a2df2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 61, 255, 0.25);
}

.otb-modal-btn.otb-primary:active {
    transform: translateY(0);
}

button[style*="d63031"] {
    /* Fallback/Support for inline styles */
    background: #d63031 !important;
    color: #fff !important;
}

/* Skeleton Loader */
@keyframes otb-skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.otb-skeleton-loading {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #f0f0f0;
    background-image: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: otb-skeleton-shimmer 1.5s infinite linear;
    border-radius: inherit;
    z-index: 1;
}

/* SEO Powered By Link */
.otb-powered-by {
    font-size: 11px;
    color: #888;
    text-align: center;
    padding: 15px 10px;
    margin-top: auto;
    border-top: 1px solid #ebebeb;
}

.otb-powered-by a {
    color: var(--otb-accent, #8b3dff);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.otb-powered-by a:hover {
    color: #6a1bcf;
    text-decoration: underline;
}

.otb-popover-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.otb-popover-row:last-child {
    margin-bottom: 0;
}

.otb-popover-label {
    font-size: 11px;
    color: #777;
    margin-bottom: 4px;
    display: block;
    text-align: left;
}

/* Align Dropdown Specific */
.otb-align-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.otb-align-grid .otb-icon-btn {
    width: 32px;
    height: 32px;
}

button[style*="d63031"] {
    /* Fallback/Support for inline styles */
    background: #d63031 !important;
    color: #fff !important;
    border: none;
    box-shadow: 0 4px 6px rgba(214, 48, 49, 0.2);
}

.otb-tool-btn.otb-btn-danger:hover {
    background: #c0392b !important;
    box-shadow: 0 6px 12px rgba(214, 48, 49, 0.3);
}

/* Text Presets */
/* Text Presets */
.otb-text-preset:not(.custom-style) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 12px 10px !important;
    margin-bottom: 15px !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-align: center !important;
    min-height: 44px !important;
}

.otb-text-preset.custom-style {
    display: flex !important;
    width: 100% !important;
    margin-bottom: 15px !important;
    background: #fff;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    overflow: hidden !important;
    padding: 0 !important;
}

.otb-text-preset.custom-style.otb-checkerboard {
    background-color: #fff;
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px 4px, 4px 0;
}

.otb-text-preset:hover {
    border-color: var(--otb-accent, #8b3dff);
    background: #f9f9f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.otb-text-preset h1,
.otb-text-preset h2,
.otb-text-preset p {
    margin: 0;
    line-height: 1.2;
    color: var(--otb-text);
}

.otb-text-preset.heading h1 {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: #000 !important;
}

.otb-text-preset.subheading h2 {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #333 !important;
}

.otb-text-preset.subheading h2:after {
    content: none !important;
    display: none !important;
    border: none !important;
}

.otb-text-preset.body p {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #555 !important;
}

/* Barcode and QR Code Styles */
.otb-code-tab {
    animation: fadeIn 0.3s ease;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
}

.otb-code-tab.otb-active {
    display: flex !important;
}

.otb-input {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff !important;
    /* Force white text */
    margin-bottom: 12px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s;
}

.otb-input:focus {
    outline: none;
    border-color: var(--otb-accent);
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
    /* Ensure text remains white on focus */
    box-shadow: 0 0 0 2px rgba(139, 61, 255, 0.2);
}

.otb-input option {
    background: #333;
    color: #fff;
}

.otb-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    margin: 15px 0;
    font-weight: 600;
}

#otb-qr-dynamic-form {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}

/* Drawing Controls */
.otb-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.otb-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.otb-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #444;
    transition: .4s;
    border-radius: 20px;
}

.otb-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.otb-slider {
    background-color: var(--otb-accent);
}

input:checked+.otb-slider:before {
    transform: translateX(20px);
}

.otb-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    margin: 0;
}

.otb-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
}

.otb-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Full-width opacity slider row */
.otb-opacity-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 2px 0 !important;
}

.otb-opacity-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 !important;
    min-width: 0 !important;
    height: 4px !important;
    background: #e0e0e0 !important;
    border-radius: 2px !important;
    outline: none !important;
    border: none !important;
    min-height: 0 !important;
    padding: 0 !important;
}

.otb-opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--otb-accent, #8b3dff);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.otb-opacity-val {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #666 !important;
    width: 32px !important;
    text-align: right !important;
    flex-shrink: 0 !important;
}

/* Specific range style for properties bar */
.otb-prop-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    min-width: 40px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    border: none !important;
    min-height: 0 !important;
    padding: 0 !important;
}

.otb-align-grid {
    display: flex;
    align-items: center;
    gap: 2px;
}

.otb-prop-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #555;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Object Overlay Buttons */
.otb-overlay-btn {
    background: transparent;
    border: none;
    color: #fff !important;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    padding: 0;
}

.otb-overlay-btn i,
.otb-overlay-btn svg {
    color: #fff !important;
    stroke: #fff !important;
}

.otb-overlay-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.otb-overlay-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.otb-overlay-btn.otb-danger {
    color: #d63031;
}

.otb-overlay-btn.otb-danger:hover {
    background: rgba(214, 48, 49, 0.15);
}

/* -- Crop UI -- */
.otb-crop-toolbar {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid #ddd;
    color: #333;
    padding: 6px 12px;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    pointer-events: all;
    max-height: 42px;
}

.otb-crop-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #333;
    padding: 6px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.otb-crop-btn:hover {
    background: #f5f5f5;
    border-color: #ddd;
}

.otb-crop-btn.otb-confirm {
    background: var(--otb-accent, #1a73e8);
    color: #fff;
}

.otb-crop-btn.otb-confirm:hover {
    filter: brightness(1.05);
}

.otb-crop-btn.otb-cancel:hover {
    background: #fff0f0;
    color: #d93025;
    border-color: #f8d7da;
}

.otb-global-tpl-info {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #111;
    color: #eee;
    padding: 15px;
    border-radius: 8px;
    width: 220px;
    z-index: 2147483647;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.otb-coords-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    display: none;
    z-index: 2147483647;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}




/* Rulers */
.otb-ruler-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--otb-canvas-bg);
}

.otb-ruler {
    position: absolute;
    background: #fff;
    z-index: 10;
    display: block;
    /* Visible by default */
    overflow: hidden;
}

.otb-ruler-h {
    top: 0;
    left: 20px;
    right: 0;
    height: 20px;
    border-bottom: 1px solid #ddd;
}

.otb-ruler-v {
    top: 20px;
    left: 0;
    bottom: 0;
    width: 20px;
    border-right: 1px solid #ddd;
}

.otb-ruler-corner {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: #fff;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    z-index: 11;
    display: flex;
    /* Visible by default */
    align-items: center;
    justify-content: center;
}

#otb-ruler-unit-select {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 8px;
    color: #444;
    cursor: pointer;
    padding: 0;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
    font-weight: 600;
}

#otb-ruler-unit-select:focus {
    outline: none;
}

.otb-ruler-h canvas,
.otb-ruler-v canvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* Grid is handled via Fabric background pattern */

/* -- Editor Loading Overlay -- */
.otb-app-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.otb-app-loading .otb-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 61, 255, 0.1);
    border-top: 4px solid #8b3dff;
    border-radius: 50%;
    animation: otb-spin 1s linear infinite;
    margin-bottom: 20px;
}

.otb-app-loading span {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #1d1d1f;
    letter-spacing: -0.01em;
}

@keyframes otb-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* -- Transparency Support -- */
.otb-color-btn {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 2px;
    cursor: pointer;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.otb-color-swatch {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    display: block;
    position: relative;
    overflow: hidden;
}

/* Base Checkerboard for Swatches */
.otb-checkerboard {
    background-color: #fff;
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px 4px, 4px 0;
}

.otb-color-swatch.is-transparent {
    background: none !important;
}

.otb-color-swatch.is-transparent::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 6px 6px;
    background-position: 0 0, 0 3px, 3px 3px, 3px 0;
}

.otb-color-swatch.is-transparent::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 1px;
    background: #e74c3c;
    transform: translate(-50%, -50%) rotate(45deg);
    z-index: 1;
}

.otb-icon-btn.is-transparent {
    color: #e74c3c !important;
    border-color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.1) !important;
}

/* --- Product Tour UI --- */
.otb-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    z-index: 999998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.otb-tour-overlay.otb-active {
    opacity: 1;
}

.otb-tour-highlight {
    position: relative;
    z-index: 999999 !important;
    box-shadow: 0 0 0 4px rgba(139, 61, 255, 0.5), 0 0 20px rgba(139, 61, 255, 0.4);
    pointer-events: none;
    /* Let clicks pass through if we want them to click it, but tour blocks clicks anyway */
    border-radius: 4px;
    background-color: #2b2b36 !important;
    transition: box-shadow 0.3s ease;
}

.otb-tour-popover {
    position: fixed;
    z-index: 999999 !important;
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    width: 280px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
}

.otb-tour-popover.otb-active {
    opacity: 1;
    transform: translateY(0);
}

.otb-tour-popover::after {
    content: '';
    position: absolute;
    border: 8px solid transparent;
}

.otb-tour-popover.place-bottom::after {
    top: -16px;
    left: 20px;
    border-bottom-color: #fff;
}

.otb-tour-popover.place-top::after {
    bottom: -16px;
    left: 20px;
    border-top-color: #fff;
}

.otb-tour-popover.place-right::after {
    left: -16px;
    top: 20px;
    border-right-color: #fff;
}

.otb-tour-popover.place-left::after {
    right: -16px;
    top: 20px;
    border-left-color: #fff;
}

.otb-tour-title {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    margin: 0 0 6px 0;
}

.otb-tour-text {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    margin: 0 0 15px 0;
}

.otb-tour-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.otb-tour-progress {
    font-size: 11px;
    color: #888;
    font-weight: 500;
}

.otb-tour-actions {
    display: flex;
    gap: 8px;
}

.otb-tour-btn {
    background: #f0f0f0;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
}

.otb-tour-btn:hover {
    background: #e4e4e4;
}

.otb-tour-btn-primary {
    background: var(--otb-accent, #8b3dff);
    color: #fff;
}

.otb-tour-btn-primary:hover {
    background: #7a32e0;
}

/* --- Help Center Modal --- */
.otb-help-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.otb-help-modal-overlay.otb-active {
    opacity: 1;
}

.otb-help-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    width: 800px;
    max-width: 90vw;
    height: 600px;
    max-height: 85vh;
    background: #1e1e24;
    /* Darker than editor base */
    border-radius: 12px;
    z-index: 1000001;
    display: none;
    opacity: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    flex-direction: column;
}

.otb-help-modal.otb-active {
    opacity: 1;
    transform: translate(-50%, -50%);
    display: flex !important;
}

.otb-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.otb-help-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.otb-help-close-btn {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
    width: 20px;
    height: 20px;
}

.otb-help-close-btn:hover {
    color: #fff;
}

.otb-help-body-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.otb-help-sidebar {
    width: 260px;
    background: rgba(0, 0, 0, 0.15);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
}

.otb-help-search-box {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

#otb-help-search {
    width: 100%;
    padding: 10px 10px 10px 34px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s;
}

#otb-help-search:focus {
    outline: none;
    border-color: var(--otb-accent);
}

.otb-help-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.otb-help-nav::-webkit-scrollbar,
.otb-help-content-area::-webkit-scrollbar {
    width: 6px;
}

.otb-help-nav::-webkit-scrollbar-track,
.otb-help-content-area::-webkit-scrollbar-track {
    background: transparent;
}

.otb-help-nav::-webkit-scrollbar-thumb,
.otb-help-content-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.otb-help-nav-category {
    padding: 16px 16px 6px 16px;
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.otb-help-nav-item {
    padding: 10px 16px;
    margin: 2px 10px;
    border-radius: 6px;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.otb-help-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.otb-help-nav-item.otb-active {
    background: var(--otb-accent);
    color: #fff;
    font-weight: 500;
}

.otb-help-content-area {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
    background: #1e1e24;
}

.otb-help-article-full h2 {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--otb-accent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 16px;
}

.otb-help-article-body {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
}

.otb-help-article-body p {
    margin: 0 0 16px 0;
}

.otb-help-article-body ul {
    margin: 0 0 16px 0;
    padding-left: 20px;
}

.otb-help-article-body li {
    margin-bottom: 8px;
}

.otb-help-article-body strong {
    color: #fff;
    font-weight: 600;
}

.otb-help-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 12px 12px;
}

.otb-drawer-header h3 {
    margin-bottom: 0px;
    font-size: 1.1rem;
}

.otb-bg-sub-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}

.otb-bg-sub-section h4 {
    font-size: 1.1rem;
}

/* Sidebar Specificity Fixes for Live Server */
.otb-nav-items {
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    line-height: 0;
}

.otb-nav-item {
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    line-height: 1;
}

.otb-drawer-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}


/* =============================================================
   GLOBAL THEME CONFLICT OVERRIDE BLOCK
   All rules below use !important to override theme CSS that 
   applies justify-content:space-between/around to flex containers,
   causing unwanted spacing in all plugin UI elements.
   This block is a self-contained safety net - safe to update.
   ============================================================= */

/* --- Utility class: apply to any flex-column container --- */
.otb-flexfix {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 0 !important;
}

/* --- Primary layout containers --- */
#otb-app .otb-app-container {
    justify-content: flex-start !important;
}

#otb-app .otb-sidebar-nav {
    justify-content: flex-start !important;
    align-items: center !important;
}

#otb-app .otb-nav-items {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

#otb-app .otb-nav-item {
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    list-style: none !important;
}

#otb-app .otb-sidebar-drawer {
    justify-content: flex-start !important;
}

#otb-app .otb-drawer-header {
    justify-content: flex-start !important;
}

#otb-app .otb-drawer-content {
    justify-content: flex-start !important;
    align-items: stretch !important;
}

#otb-app .otb-workspace-area {
    justify-content: flex-start !important;
}

/* --- Drawer sections --- */
#otb-app .otb-drawer-section {
    justify-content: flex-start !important;
}

#otb-app .otb-bg-sub-section {
    justify-content: flex-start !important;
}

#otb-app .otb-code-tab {
    justify-content: flex-start !important;
}

/* --- ALL toolbar popovers (covers shadow-popover, align-popover, etc.) ---
   When a popover becomes active (.otb-active), it switches to flex-column so
   the theme can never override justify-content to space-between/around. */
#otb-app .otb-toolbar-popover.otb-active {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 0 !important;
}

/* Rows INSIDE a popover that intentionally use justify-content:space-between
   (e.g. label + value pairs) keep their own inline style since they 
   are not flex-column, they are flex-row. No override needed. */

/* --- Properties bar groups --- */
#otb-app .otb-prop-group {
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 4px 0 !important;
    margin: 0 !important;
}

/* Groups inside sidebar sections inherit padding from the section */
.otb-sidebar-section .otb-prop-group,
.otb-prop-section .otb-prop-group {
    padding: 2px 0 !important;
}

/* --- Specific popover resets --- */

#otb-app #shadow-popover.otb-active {
    gap: 8px !important;
    /* shadow popover rows need breathing room */
}

/* --- Prevent theme from adding list-style or spacing to nav items --- */
#otb-app .otb-nav-items *,
#otb-app .otb-nav-items *::before,
#otb-app .otb-nav-items *::after {
    list-style: none !important;
    list-style-type: none !important;
}


/* Floating "Disable Drawing" Button */
.otb-floating-btn {
    position: absolute !important;
    bottom: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(20px) !important;
    background: linear-gradient(135deg, #ff4757, #ff6b81) !important;
    color: #fff !important;
    padding: 12px 24px !important;
    border-radius: 40px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    display: none !important;
    /* Managed by JS (otb-active class) */
    align-items: center !important;
    gap: 10px !important;
    box-shadow: 0 10px 25px rgba(255, 71, 87, 0.4) !important;
    z-index: 2000 !important;
    opacity: 0 !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
}

.otb-floating-btn.otb-active {
    display: flex !important;
    opacity: 1 !important;
    transform: translateX(-50%) translateY(0) !important;
}

.otb-floating-btn:hover {
    box-shadow: 0 15px 30px rgba(255, 71, 87, 0.5) !important;
    transform: translateX(-50%) translateY(-3px) !important;
    background: linear-gradient(135deg, #ff6b81, #ff4757) !important;
}

.otb-floating-btn:active {
    transform: translateX(-50%) translateY(0) !important;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.3) !important;
}

/* ============================================================
   MOBILE RESPONSIVENESS (HIGH SPECIFICITY)
   ============================================================ */
@media screen and (max-width: 768px) {

    /* Main Layout: Stack vertically, nav at bottom */
    html body #otb-app .otb-app-container,
    html body #otb-editor-overlay .otb-app-container,
    html body .otb-app-container {
        flex-direction: column-reverse !important;
    }

    /* Bottom Navigation Bar */
    html body #otb-app .otb-sidebar-nav,
    html body #otb-editor-overlay .otb-sidebar-nav,
    html body .otb-sidebar-nav {
        width: 100vw !important;
        min-width: 100vw !important;
        height: 65px !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        padding: 0 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-right: none !important;
        z-index: 2100 !important;   /* above mobile-sheet (1595), mobile-strip (1600), backdrop (1590) */
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
    }

    html body #otb-editor-overlay .otb-nav-items,
    html body .otb-nav-items {
        flex-direction: row !important;
        width: 100% !important;
        justify-content: space-around !important;
        align-items: center !important;
    }

    html body #otb-editor-overlay .otb-nav-item,
    html body .otb-nav-item {
        height: 65px !important;
        width: auto !important;
        flex: 1 !important;
        padding: 5px 0 !important;
        margin: 0 !important;
    }

    html body #otb-editor-overlay .otb-nav-item .otb-nav-icon,
    html body .otb-nav-item .otb-nav-icon {
        font-size: 24px !important;
        margin-bottom: 0 !important;
    }

    html body #otb-editor-overlay .otb-nav-item span,
    html body .otb-nav-item span {
        display: none !important;
    }

    /* Hide the collapse chevron button on mobile entirely */
    html body #otb-editor-overlay #otb-nav-collapse,
    html body #otb-nav-collapse {
        display: none !important;
    }

    /* Drawer: Full width overlay above the bottom nav */
    html body #otb-editor-overlay .otb-sidebar-drawer,
    html body .otb-sidebar-drawer {
        position: fixed !important;
        bottom: 65px !important;
        left: 0 !important;
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        height: calc(100vh - 65px - 60px) !important;
        /* Total viewport minus bottom nav minus topbar */
        max-height: calc(100vh - 65px - 60px) !important;
        z-index: 2000 !important;
        border-radius: 12px 12px 0 0 !important;
        transform: translateY(100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-out !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Active drawer on mobile */
    html body #otb-editor-overlay .otb-app-container:not(.collapsed) .otb-sidebar-drawer,
    html body .otb-app-container:not(.collapsed) .otb-sidebar-drawer {
        transform: translateY(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    html body #otb-editor-overlay .otb-app-container.collapsed .otb-sidebar-drawer,
    html body .otb-app-container.collapsed .otb-sidebar-drawer {
        transform: translateY(100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Add a close button for the drawer on mobile */
    html body #otb-editor-overlay .otb-mobile-drawer-close,
    html body .otb-mobile-drawer-close {
        display: flex !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border: none !important;
        color: #fff !important;
        font-size: 20px !important;
        cursor: pointer !important;
        padding: 5px !important;
        border-radius: 50% !important;
        margin-left: auto !important;
        width: 32px !important;
        height: 32px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Light background Overwrite (Right Properties Bar) */
    html body .otb-properties-bar .otb-mobile-drawer-close {
        color: #333 !important;
        background: #f1f1f1 !important;
        border: 1px solid #ddd !important;
    }

    html body #otb-editor-overlay .otb-drawer-header,
    html body .otb-drawer-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 15px !important;
    }

    /* Top Toolbar horizontally scrollable */
    html body #otb-editor-overlay .otb-toolbar,
    html body .otb-toolbar {
        position: relative !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        flex-wrap: nowrap !important;
        padding: 0 10px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        /* Firefox */
    }

    html body #otb-editor-overlay .otb-toolbar::-webkit-scrollbar,
    html body .otb-toolbar::-webkit-scrollbar {
        display: none !important;
        /* Chrome/Safari */
    }

    /* ================================================================
   PATCH: Mobile Properties Panel - Bottom Sheet UX
   File: public/css/otb-editor.css
   Lines to Replace: 3457-3522
   ================================================================ */

    /* REPLACE THIS SECTION (Lines 3457-3522) WITH THE CODE BELOW: */

    /* Properties bar: BOTTOM SHEET on mobile for better canvas visibility */
    html body #otb-editor-overlay .otb-properties-bar,
    html body .otb-properties-bar {
        position: fixed !important;
        bottom: 65px !important;
        /* Above bottom navigation */
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 45vh !important;
        /* Takes ~45% of screen height */
        max-height: 500px !important;
        /* Cap maximum height */
        min-height: 0 !important;
        top: auto !important;
        border-top: 1px solid #e0e0e0 !important;
        border-left: none !important;
        border-radius: 16px 16px 0 0 !important;
        /* Rounded top corners */
        background: #fff !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        white-space: normal !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        padding: 0 !important;
        z-index: 1500 !important;
        transform: translateY(calc(100% + 65px)) !important;
        /* Hidden below viewport */
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), height 0.25s ease !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
        scrollbar-width: thin !important;
    }

    /* Visible state: slides up from bottom */
    html body #otb-editor-overlay .otb-properties-bar.otb-visible,
    html body .otb-properties-bar.otb-visible {
        transform: translateY(0) !important;
    }

    /* Collapsed state: shows only header bar with controls */
    html body #otb-editor-overlay .otb-properties-bar.otb-collapsed,
    html body .otb-properties-bar.otb-collapsed {
        height: 80px !important;
        overflow: hidden !important;
    }

    /* Drag handle visual affordance at top of sheet */
    html body .otb-properties-bar::before {
        content: '' !important;
        display: block !important;
        width: 40px !important;
        height: 4px !important;
        background: #d0d0d0 !important;
        border-radius: 2px !important;
        margin: 8px auto 12px !important;
        flex-shrink: 0 !important;
    }

    /* Adjust close button position for bottom sheet layout */
    html body .otb-properties-bar .otb-mobile-drawer-close {
        position: absolute !important;
        top: 8px !important;
        right: 12px !important;
        z-index: 10 !important;
    }

    /* Collapse/expand toggle button (will be added by JS) */
    html body .otb-properties-bar .otb-sheet-toggle {
        position: absolute !important;
        top: 8px !important;
        left: 12px !important;
        background: rgba(0, 0, 0, 0.05) !important;
        border: none !important;
        border-radius: 50% !important;
        width: 28px !important;
        height: 28px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        color: #555 !important;
        font-size: 16px !important;
        z-index: 10 !important;
        padding: 0 !important;
    }

    /* Content padding for bottom sheet */
    html body .otb-properties-bar>*:not(.otb-mobile-drawer-close):not(.otb-sheet-toggle) {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Ensure first content section has proper top spacing */
    html body .otb-properties-bar>.otb-prop-group:first-of-type,
    html body .otb-properties-bar>.otb-prop-section:first-of-type,
    html body .otb-properties-bar>.otb-sidebar-section:first-of-type {
        padding-top: 48px !important;
        /* Space for handle + buttons */
    }

    html body #otb-editor-overlay .otb-properties-bar::-webkit-scrollbar,
    html body .otb-properties-bar::-webkit-scrollbar {
        width: 3px !important;
    }

    html body .otb-properties-bar::-webkit-scrollbar-thumb {
        background: #ddd !important;
        border-radius: 2px !important;
    }

    html body #otb-editor-overlay .otb-prop-group,
    html body .otb-prop-group {
        flex-wrap: wrap !important;
        flex-shrink: 0 !important;
        width: 100% !important;
    }

    html body #otb-editor-overlay .otb-actions-group,
    html body .otb-actions-group {
        margin-left: 0 !important;
        flex-shrink: 0 !important;
    }

    /* Properties bar backdrop: tap outside to close */
    html body .otb-props-backdrop {
        display: none !important;
        position: fixed !important;
        inset: 0 !important;
        z-index: 1490 !important;
        background: transparent !important;
    }

    html body .otb-props-backdrop.otb-visible {
        display: block !important;
        background: rgba(0, 0, 0, 0.15) !important;
        /* Slightly darker for bottom sheet */
    }

    /* Landscape orientation: use more vertical space */
    @media screen and (max-width: 768px) and (orientation: landscape) {

        html body #otb-editor-overlay .otb-properties-bar,
        html body .otb-properties-bar {
            height: 60vh !important;
            max-height: 400px !important;
        }
    }

    /* Very small screens: adjust height */
    @media screen and (max-width: 375px) {

        html body #otb-editor-overlay .otb-properties-bar,
        html body .otb-properties-bar {
            height: 50vh !important;
        }
    }

    /* Support for dynamic viewport units (avoids keyboard overlap) */
    @supports (height: 100dvh) {

        html body #otb-editor-overlay .otb-properties-bar,
        html body .otb-properties-bar {
            height: 45dvh !important;
            max-height: calc(45dvh - env(safe-area-inset-bottom, 0px)) !important;
        }

        @media screen and (max-width: 768px) and (orientation: landscape) {

            html body #otb-editor-overlay .otb-properties-bar,
            html body .otb-properties-bar {
                height: 60dvh !important;
            }
        }

        @media screen and (max-width: 375px) {

            html body #otb-editor-overlay .otb-properties-bar,
            html body .otb-properties-bar {
                height: 50dvh !important;
            }
        }
    }

    /* END OF REPLACEMENT SECTION */


    /* Canvas area: sits between the toolbar (60px) and bottom nav+bar (64px+44px=109px) */
    html body #otb-editor-overlay .otb-canvas-container,
    html body .otb-canvas-container {
        padding: 24px 12px 20px 12px !important;
        height: calc(100dvh - 60px - 109px) !important;
        /* dvh avoids mobile URL-bar issues */
        /* fallback for browsers without dvh */
        height: calc(100vh - 60px - 109px) !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    @supports (height: 100dvh) {

        html body #otb-editor-overlay .otb-canvas-container,
        html body .otb-canvas-container {
            height: calc(100dvh - 60px - 109px) !important;
        }
    }

    html body #otb-editor-overlay .otb-workspace-area,
    html body .otb-workspace-area {
        height: calc(100dvh - 65px) !important;
        height: calc(100vh - 65px) !important;
        /* fallback */
        overflow: hidden !important;
    }

    @supports (height: 100dvh) {

        html body #otb-editor-overlay .otb-workspace-area,
        html body .otb-workspace-area {
            height: calc(100dvh - 65px) !important;
        }
    }

    /* Hide rulers on mobile — recovers the 20px offset and simplifies layout */
    html body .otb-ruler,
    html body .otb-ruler-corner {
        display: none !important;
    }

    /* Ruler wrapper: no ruler offset needed */
    html body .otb-ruler-wrapper {
        padding-top: 0 !important;
        padding-left: 0 !important;
    }

    /* Toolbar buttons: enforce 44×44px min tap target (WCAG) */
    html body .otb-toolbar-btn {
        min-width: 40px !important;
        min-height: 40px !important;
    }

    /* Icon buttons in properties bar: minimum 36px tap target */
    html body .otb-icon-btn {
        min-width: 36px !important;
        min-height: 36px !important;
    }

    /* Prevent browser native pan/zoom interfering with Fabric.js touch events */
    html body .canvas-container canvas {
        touch-action: none !important;
    }

    /* Toolbar Popovers */
    html body #otb-editor-overlay .otb-toolbar-popover,
    html body .otb-toolbar-popover,
    html body .otb-font-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-width: 320px !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
        z-index: 100000 !important;
    }

    /* Crop Toolbar */
    html body #otb-editor-overlay .otb-crop-toolbar,
    html body .otb-crop-toolbar {
        bottom: 80px !important;
        width: 90% !important;
        justify-content: center !important;
    }

    /* Pages / Bottom bar is now above the nav on mobile */
    html body #otb-editor-overlay .otb-bottom-bar,
    html body .otb-bottom-bar {
        position: fixed !important;
        bottom: 65px !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 2050 !important;   /* above mobile-sheet (1595), mobile-strip (1600), backdrop (1590); below nav (2100) */
    }

    /* Relocate Close control to bottom right, above bottom nav and toolbar */
    html body #otb-editor-overlay .otb-window-controls,
    html body .otb-window-controls {
        top: auto !important;
        bottom: 115px !important;
        /* Increased from 80px to clear toolbar/tabs */
        left: auto !important;
        right: 15px !important;
        background: rgba(0, 0, 0, 0.7) !important;
        padding: 4px !important;
        border-radius: 8px !important;
    }

    html body #otb-editor-overlay .otb-win-btn,
    html body .otb-win-btn {
        width: 32px !important;
        /* Smaller on mobile */
        height: 32px !important;
        margin: 0 !important;
        background: rgba(255, 255, 255, 0.15) !important;
        border-radius: 6px !important;
    }

    html body #otb-editor-overlay .otb-win-btn svg.lucide,
    html body .otb-win-btn svg.lucide {
        width: 14px !important;
        height: 14px !important;
    }

    /* Horizontal Scroll Hint Animation */
    @keyframes otb-swipe-hint {
        0% {
            transform: translateX(0);
            opacity: 0.8;
        }

        50% {
            transform: translateX(-8px);
            opacity: 1;
        }

        100% {
            transform: translateX(0);
            opacity: 0.8;
        }
    }

    @keyframes otb-fade-out {
        0% {
            opacity: 1;
            visibility: visible;
        }

        80% {
            opacity: 1;
            visibility: visible;
        }

        100% {
            opacity: 0;
            visibility: hidden;
        }
    }

    html body #otb-editor-overlay .otb-mobile-scroll-hint,
    html body .otb-mobile-scroll-hint {
        position: sticky !important;
        right: 0 !important;
        top: 0 !important;
        height: 100% !important;
        width: 40px !important;
        background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 50%, rgba(255, 255, 255, 1) 100%) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        padding-right: 10px !important;
        color: var(--otb-accent) !important;
        pointer-events: none !important;
        z-index: 100 !important;
        flex-shrink: 0 !important;
        transition: opacity 0.3s ease-out !important;
    }

    /* Target the SVG icon inside the hint to do the sliding animation */
    html body #otb-editor-overlay .otb-mobile-scroll-hint i,
    html body .otb-mobile-scroll-hint i {
        animation: otb-swipe-hint 1.2s infinite ease-in-out !important;
    }

    /* Floating draw-mode button: lift above bottom nav */
    html body .otb-floating-btn {
        bottom: 120px !important;
        font-size: 12px !important;
        padding: 10px 18px !important;
    }

    /* Help modal: full-screen on mobile */
    html body .otb-help-modal {
        width: 100vw !important;
        height: 100dvh !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
    }

    html body .otb-help-modal.otb-active {
        transform: none !important;
    }

    /* Modal box: full width */
    html body .otb-modal-box {
        width: 90vw !important;
        max-width: 90vw !important;
    }

    /* ── Suppress the old 45vh bottom-sheet on mobile now that the new system handles it ── */
    html body .otb-properties-bar {
        display: none !important;
    }

    /* ─────────────────────────────────────────────────────────────
       MOBILE ACTION STRIP
       Fixed thin bar just above the bottom nav.
       Visible only when an object is selected.
    ───────────────────────────────────────────────────────────── */
    html body .otb-mobile-strip {
        position: fixed !important;
        bottom: 109px !important;           /* 65px nav + 44px .otb-bottom-bar */
        left: 0 !important;
        right: 0 !important;
        height: 52px !important;
        background: #fff !important;
        border-top: 1px solid #e8e8e8 !important;
        display: flex !important;
        align-items: center !important;
        padding: 0 10px !important;
        gap: 2px !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        z-index: 1600 !important;           /* above sheet backdrop (1590) */
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch !important;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.08) !important;
    }
    html body .otb-mobile-strip[aria-hidden="true"] {
        display: none !important;
    }
    html body .otb-mobile-strip::-webkit-scrollbar { display: none !important; }

    /* Strip buttons — reuse same class patterns as desktop .otb-strip-btn */
    html body .otb-mstrip-btn {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        min-width: 44px !important;
        height: 44px !important;
        border-radius: 6px !important;
        border: none !important;
        background: transparent !important;
        color: #333 !important;
        cursor: pointer !important;
        flex-shrink: 0 !important;
        padding: 0 4px !important;
        transition: background 0.12s, color 0.12s !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    html body .otb-mstrip-btn svg {
        width: 18px !important;
        height: 18px !important;
        flex-shrink: 0 !important;
    }
    html body .otb-mstrip-label {
        font-size: 9px !important;
        font-weight: 500 !important;
        line-height: 1 !important;
        max-width: 44px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    html body .otb-mstrip-btn:active,
    html body .otb-mstrip-btn.active {
        background: rgba(139,61,255,0.1) !important;
        color: var(--otb-accent) !important;
    }
    html body .otb-mstrip-btn.active-panel {
        background: rgba(139,61,255,0.1) !important;
        color: var(--otb-accent) !important;
        outline: 1px solid rgba(139,61,255,0.3) !important;
        border-radius: 6px !important;
    }
    html body .otb-mstrip-btn.otb-mstrip-action {
        font-size: 12px !important;
        font-weight: 600 !important;
        min-width: 52px !important;
        flex-direction: row !important;
        gap: 4px !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 6px !important;
        padding: 0 10px !important;
    }
    html body .otb-mstrip-btn.otb-mstrip-icon {
        min-width: 40px !important;
    }
    html body .otb-mstrip-div {
        width: 1px !important;
        height: 24px !important;
        background: #e8e8e8 !important;
        flex-shrink: 0 !important;
        align-self: center !important;
        margin: 0 3px !important;
    }
    html body .otb-mstrip-stepper {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0 !important;
        flex-shrink: 0 !important;
        background: rgba(0,0,0,0.04) !important;
        border-radius: 6px !important;
        overflow: hidden !important;
    }
    html body .otb-mstrip-step-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 30px !important;
        height: 36px !important;
        font-size: 16px !important;
        font-weight: 500 !important;
        background: none !important;
        border: none !important;
        color: #333 !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
        flex-shrink: 0 !important;
    }
    html body .otb-mstrip-step-btn:active {
        background: rgba(139,61,255,0.12) !important;
        color: var(--otb-accent) !important;
    }
    html body .otb-mstrip-step-val {
        min-width: 28px !important;
        text-align: center !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        color: #333 !important;
        pointer-events: none !important;
    }
    html body .otb-mstrip-info {
        font-size: 12px !important;
        color: #888 !important;
        padding: 0 6px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    /* ─────────────────────────────────────────────────────────────
       MOBILE HALF-SHEET
       Slides up from below the strip to show panel details.
       Default height ~220px (compact). Scrollable inside.
    ───────────────────────────────────────────────────────────── */
    html body .otb-mobile-sheet {
        position: fixed !important;
        bottom: 161px !important;           /* 65px nav + 44px bottom-bar + 52px strip */
        left: 0 !important;
        right: 0 !important;
        height: 230px !important;           /* JS overrides this inline during drag */
        min-height: 230px !important;
        max-height: 80vh !important;
        background: #fff !important;
        border-top: 1px solid #e0e0e0 !important;
        border-radius: 16px 16px 0 0 !important;
        z-index: 1595 !important;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.12) !important;
        transform: translateY(100%) !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    html body .otb-mobile-sheet.otb-sheet-open {
        transform: translateY(0) !important;
    }
    html body .otb-mobile-sheet[aria-hidden="true"]:not(.otb-sheet-open) {
        pointer-events: none !important;
    }

    /* Drag handle pill — pointer-events off; parent header handles touch */
    html body .otb-mobile-sheet-handle {
        width: 36px !important;
        height: 4px !important;
        background: #d0d0d0 !important;
        border-radius: 2px !important;
        margin: 8px auto 4px !important;
        flex-shrink: 0 !important;
        pointer-events: none !important;
    }

    /* Full-width tap / drag zone above the sheet body */
    html body .otb-sheet-drag-header {
        width: 100% !important;
        padding: 4px 0 2px 0 !important;
        flex-shrink: 0 !important;
        display: flex !important;
        justify-content: center !important;
        cursor: ns-resize !important;
        touch-action: none !important;
        user-select: none !important;
        -webkit-user-select: none !important;
    }

    /* While dragging: disable the slide-in transition so height tracks the finger */
    html body .otb-mobile-sheet.otb-sheet-dragging {
        transition: none !important;
    }

    /* Scrollable body */
    html body .otb-mobile-sheet-body {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 0 !important;
        scrollbar-width: thin !important;
    }
    html body .otb-mobile-sheet-body::-webkit-scrollbar {
        width: 3px !important;
    }
    html body .otb-mobile-sheet-body::-webkit-scrollbar-thumb {
        background: #ddd !important;
        border-radius: 2px !important;
    }

    /* Sheet title row */
    html body .otb-msheet-title {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 8px 14px 6px !important;
        border-bottom: 1px solid #f0f0f0 !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #333 !important;
        flex-shrink: 0 !important;
    }
    html body .otb-msheet-close {
        width: 24px !important;
        height: 24px !important;
        border: none !important;
        background: #f0f0f0 !important;
        border-radius: 50% !important;
        color: #666 !important;
        font-size: 13px !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
    }

    /* All panel content inside the sheet: padding + touch-friendly row sizes */
    html body .otb-mobile-sheet-body .otb-panel-rows {
        padding: 10px 14px !important;
        gap: 12px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-row {
        min-height: 36px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-row-label {
        min-width: 80px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-fill-wrap,
    html body .otb-mobile-sheet-body .otb-panel-font-list,
    html body .otb-mobile-sheet-body .otb-panel-icon-grid {
        padding: 10px 14px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-font-item {
        padding: 10px 12px !important;
        font-size: 15px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-icon-btn {
        min-height: 44px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-icon-btn-sm {
        width: 40px !important;
        height: 40px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-action-btn {
        min-height: 40px !important;
        padding: 10px 14px !important;
        font-size: 14px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-slider {
        height: 6px !important;
    }
    html body .otb-mobile-sheet-body .otb-panel-color-swatch {
        width: 38px !important;
        height: 30px !important;
    }

    /* renderColorProp gradient toggle and solid swatch — larger touch targets */
    html body .otb-mobile-sheet-body .otb-icon-btn {
        min-width: 40px !important;
        min-height: 40px !important;
    }
    html body .otb-mobile-sheet-body .otb-color-btn {
        width: 36px !important;
        height: 36px !important;
    }

    /* ── Sheet backdrop ── */
    html body .otb-mobile-sheet-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 109px !important;   /* stop at nav(65) + bar(44) — don't cover those */
        background: transparent !important;
        z-index: 1590 !important;
        pointer-events: none !important;
        transition: background 0.2s !important;
    }
    html body .otb-mobile-sheet-backdrop.otb-sheet-open {
        pointer-events: auto !important;
        background: rgba(0,0,0,0.12) !important;
    }

    /* ── Canvas extra bottom padding when strip is visible ──
       Prevents the fixed strip from covering the bottom of the canvas.
       Strip bottom = 109px (nav 65 + bottom-bar 44), strip height = 52px,
       so the strip's top edge is at 109 + 52 = 161px from the screen bottom.
       The canvas already accounts for nav (65px) + bottom-bar (44px) = 109px
       in its height calc, so we only need extra padding for the strip's 52px. */
    html body .otb-canvas-container {
        padding-bottom: 64px !important;
    }

    /* Font search in the mobile sheet — full width, large enough to type */
    html body .otb-mobile-sheet-body .otb-panel-search {
        font-size: 16px !important;  /* prevents iOS auto-zoom on focus */
    }

}

/* ── Base rules (desktop hides mobile elements) ── */
.otb-mobile-strip,
.otb-mobile-sheet,
.otb-mobile-sheet-backdrop {
    display: none !important;
}
@media screen and (max-width: 768px) {
    .otb-mobile-strip  { display: flex !important; }
    .otb-mobile-sheet  { display: flex !important; }
    .otb-mobile-sheet-backdrop { display: block !important; }
}

/* --- [otb_templates_list] Shortcode --- */
.otb-templates-masonry {
    column-count: var(--otb-columns, 3);
    column-gap: 20px;
    width: 100%;
    margin: 20px 0;
}

.otb-template-item {
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    margin-bottom: 25px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
}

.otb-template-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.otb-template-thumb-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #fdfdfd;
}

.otb-template-thumb {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.3s ease;
}

.otb-template-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    text-align: center;
}

.otb-template-item:hover .otb-template-overlay {
    opacity: 1;
}

.otb-template-item:hover .otb-template-thumb {
    filter: blur(2px) brightness(0.8);
}

.otb-template-title-rollover {
    color: #fff;
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.otb-template-footer {
    padding: 12px;
    background: #fff;
}

.otb-template-title-below {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 700;
    color: #222;
    text-align: center;
    line-height: 1.3;
}

/* Responsive Masonry Overrides — never override the modal grid (it uses --otb-columns explicitly) */
@media (max-width: 1000px) {
    .otb-templates-masonry:not(.otb-category-modal-grid) {
        column-count: 3 !important;
    }
}

@media (max-width: 700px) {
    .otb-templates-masonry:not(.otb-category-modal-grid) {
        column-count: 2 !important;
    }
}

@media (max-width: 450px) {
    .otb-templates-masonry:not(.otb-category-modal-grid) {
        column-count: 1 !important;
    }
}

/* Modal grid: graceful column reduction at very narrow viewports */
@media (max-width: 600px) {
    .otb-category-modal-grid {
        column-count: 2 !important;
    }
}

@media (max-width: 400px) {
    .otb-category-modal-grid {
        column-count: 1 !important;
    }
}

/* ─── Grouped-Category View ([otb_templates_list] with no category/ids) ─── */
.otb-grouped-categories {
    width: 100%;
}

.otb-category-section {
    margin-bottom: 48px;
}

.otb-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.otb-category-heading {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.otb-category-count {
    font-size: 14px;
    font-weight: 400;
    color: #888;
    margin-left: 4px;
}

.otb-category-description {
    margin: 0 0 14px;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.otb-view-all-btn {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    padding: 6px 16px;
    border: 2px solid #1a1a2e;
    border-radius: 6px;
    background: transparent;
    color: #1a1a2e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.otb-view-all-btn:hover {
    background: #1a1a2e;
    color: #fff;
}

/* ─── Category Modal ─── */
.otb-category-modal {
    position: fixed;
    inset: 0;
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
}

.otb-category-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.otb-category-modal-dialog {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 12px;
    width: min(92vw, 1100px);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.otb-category-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.otb-category-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.otb-category-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.otb-category-modal-close:hover {
    background: #f0f0f0;
    color: #111;
}

.otb-category-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px 24px;
    -webkit-overflow-scrolling: touch;
}

.otb-category-modal-body .otb-templates-masonry {
    margin: 0;
}

.otb-category-modal-loader {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 14px;
}

@media (max-width: 600px) {
    .otb-category-modal-dialog {
        width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
    }

    .otb-category-modal-body {
        padding: 14px 16px;
    }

    .otb-category-heading {
        font-size: 16px;
    }
}

/* ─── Format Popover (Text options, body-fixed, never clipped by sidebar) ─── */
.otb-format-popover {
    /* Displayed block with fixed positioning set by JS.
       Override the base .otb-toolbar-popover overflow:hidden so inner
       content can scroll vertically when the popover is taller than viewport. */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 14px !important;
    border-radius: 10px !important;
    line-height: 1.4 !important;
    /* Limit height so it never exceeds the viewport */
    max-height: min(480px, 80vh) !important;
}

.otb-format-popover .otb-popover-label {
    font-size: 10px;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 6px 0;
    display: block;
}

.otb-format-popover .otb-popover-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

/* Subtle scrollbar inside the popover */
.otb-format-popover::-webkit-scrollbar {
    width: 4px;
}

.otb-format-popover::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* ─── Image Actions Row (Crop + Tint side-by-side) ──────────────────────── */
.otb-image-actions-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 2px 0 !important;
    flex-wrap: nowrap !important;
}

/* ─── Image prop rows (Radius + Mask inside Shape section) ──────────────── */
.otb-image-prop-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 3px 0 !important;
    flex-wrap: nowrap !important;
}

.otb-image-prop-label {
    font-size: 11px;
    color: #888;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 36px;
}

/* Stepper widget (replaces the old ad-hoc styled buttons) */
.otb-stepper {
    display: flex !important;
    align-items: center !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    height: 28px !important;
    background: #fff !important;
    flex-shrink: 0 !important;
}

.otb-stepper-btn {
    width: 26px !important;
    height: 100% !important;
    border: none !important;
    background: #f8f9fa !important;
    cursor: pointer !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #555 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: background 0.15s !important;
    flex-shrink: 0 !important;
}

.otb-stepper-btn:hover {
    background: #eef1f4 !important;
    color: #1a73e8 !important;
}

.otb-stepper-input {
    width: 44px !important;
    text-align: center !important;
    border: none !important;
    border-left: 1px solid #eee !important;
    border-right: 1px solid #eee !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #333 !important;
    height: 100% !important;
    padding: 0 !important;
    outline: none !important;
    background: #fff !important;
    -moz-appearance: textfield !important;
    appearance: textfield !important;
    min-height: 0 !important;
}

.otb-stepper-input::-webkit-outer-spin-button,
.otb-stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Shape mask select inside the image section */
.otb-image-shape-select {
    flex: 1 !important;
    height: 28px !important;
    font-size: 11px !important;
    padding: 0 6px !important;
}

/* ─── Tint Overlay Popover ───────────────────────────────────────────────── */
.otb-tint-popover {
    width: 260px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    line-height: 1.4 !important;
}

.otb-tint-header {
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    padding: 9px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.otb-tint-title {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Each control row inside the popover */
.otb-tint-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    border-bottom: 1px solid #f5f5f5;
}

.otb-tint-row:last-child {
    border-bottom: none;
}

.otb-tint-row-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    min-width: 46px;
    flex-shrink: 0;
}

/* Color row */
.otb-tint-color-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.otb-tint-swatch-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}

.otb-tint-swatch-btn input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.otb-tint-swatch {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.otb-tint-hex-val {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* Slider row */
.otb-tint-slider-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.otb-tint-range {
    flex: 1 !important;
    min-width: 0 !important;
}

.otb-tint-pct-val {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

/* Mode select */
.otb-tint-mode-row {
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
}

.otb-tint-mode-select {
    flex: 1 !important;
    height: 28px !important;
    font-size: 11px !important;
    border: 1px solid #ddd !important;
    border-radius: 5px !important;
    padding: 0 6px !important;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer !important;
    outline: none !important;
}

.otb-tint-mode-select:hover {
    border-color: #bbb !important;
}

/* Hint row */
.otb-tint-hint {
    padding: 7px 13px 9px;
    font-size: 10px;
    color: #aaa;
    line-height: 1.4;
    font-style: italic;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
}

/* ─── Sidebar polish: section headers, spacing, visual hierarchy ─────────── */

/* Top breathing room — the first section gets a touch of extra top padding
   so controls never feel attached to the sidebar's top edge. */
.otb-properties-bar>.otb-sidebar-section:first-child,
.otb-properties-bar>.otb-prop-group:first-child,
.otb-properties-bar>.otb-prop-section:first-child {
    padding-top: 14px !important;
}

/* The icon-grid (used in action grids) respects section padding */
.otb-sidebar-section .otb-icon-grid,
.otb-prop-section .otb-icon-grid {
    padding: 0 !important;
    margin-top: 2px !important;
    gap: 5px !important;
}

/* renderColorProp returns an otb-prop-group wrapping another otb-prop-group.
   Zero out the outer wrapper's own padding so it doesn't double-space. */
.otb-sidebar-section>.otb-prop-group>.otb-prop-group {
    padding: 0 !important;
}

/* Layer label inline prefix inside a prop-group */
.otb-layer-prefix {
    font-size: 10px;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: 2px;
}

/* Scrollbar for the properties bar */
.otb-properties-bar::-webkit-scrollbar {
    width: 4px !important;
}

.otb-properties-bar::-webkit-scrollbar-thumb {
    background: #e0e0e0 !important;
    border-radius: 2px !important;
}

.otb-properties-bar::-webkit-scrollbar-track {
    background: transparent !important;
}

/* ─── Multi-select header ────────────────────────────────────────────────── */
.otb-multi-header-section {
    padding-bottom: 8px !important;
}

.otb-multi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.otb-multi-header-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.otb-multi-header-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Group / Ungroup shared button style ────────────────────────────────── */
.otb-group-btn,
.otb-ungroup-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 5px 10px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    border: none !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease !important;
    line-height: 1 !important;
}

.otb-group-btn {
    background: rgba(139, 61, 255, 0.10) !important;
    color: #8b3dff !important;
}

.otb-group-btn:hover {
    background: rgba(139, 61, 255, 0.18) !important;
}

.otb-ungroup-btn {
    background: #f3f4f6 !important;
    color: #555 !important;
}

.otb-ungroup-btn:hover {
    background: #e8eaed !important;
    color: #333 !important;
}

/* ─── Group banner (single-object group view) ────────────────────────────── */
.otb-group-banner-section {
    padding-bottom: 10px !important;
}

.otb-group-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.otb-group-banner-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.otb-group-banner-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

/* ─── Group child color swatches ─────────────────────────────────────────── */
.otb-group-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.otb-group-color-swatch {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

.otb-group-swatch-label {
    display: block;
    cursor: pointer;
    line-height: 0;
}

.otb-group-swatch-preview {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s, box-shadow 0.15s;
}

.otb-group-color-swatch:hover .otb-group-swatch-preview,
.otb-group-grad-swatch:hover .otb-group-swatch-preview {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.otb-group-color-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
}

.otb-group-swatch-count {
    font-size: 9px;
    font-weight: 700;
    color: #aaa;
    line-height: 1;
    text-align: center;
}

.otb-group-grad-swatch {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
}

/* ─── Shadow Popover — slider-based layout ───────────────────────────────── */
.otb-shadow-popover {
    width: 240px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    line-height: 1.4 !important;
}

.otb-shadow-pop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 13px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.otb-shadow-pop-title {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.otb-shadow-color-btn {
    width: 26px !important;
    height: 26px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    position: relative !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    padding: 2px !important;
    background: #fff !important;
}

/* Each slider row */
.otb-shadow-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border-bottom: 1px solid #f5f5f5;
}

.otb-shadow-slider-row:last-child {
    border-bottom: none;
}

.otb-shadow-slider-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    min-width: 54px;
    flex-shrink: 0;
}

.otb-shadow-range {
    flex: 1 !important;
    min-width: 0 !important;
    height: 4px !important;
}

.otb-shadow-slider-val {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ─── Text Tools Row (T + bg + align in one row) ─────────────────────────── */
.otb-text-tools-row {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    padding: 4px 0 !important;
}

/* Slightly larger hit target for text tool buttons for usability */
.otb-text-tool-btn {
    flex-shrink: 0 !important;
}

/* ============================================================
   TABLET BREAKPOINT (769px – 1024px)
   Narrows sidebar + drawer so canvas gets more room,
   but keeps the full desktop column layout.
   ============================================================ */
@media screen and (min-width: 769px) and (max-width: 1024px) {

    /* Shrink the drawer from 340px → 260px */
    html body .otb-sidebar-drawer {
        width: 260px !important;
        min-width: 260px !important;
        --otb-drawer-width: 260px !important;
    }

    /* Shrink the properties bar from 280px → 230px */
    html body .otb-properties-bar {
        width: 230px !important;
        min-width: 230px !important;
    }

    /* Smaller canvas padding gives more room */
    html body .otb-canvas-container {
        padding: 24px 24px !important;
    }

    /* Tighten drawer content padding */
    html body .otb-drawer-content {
        padding: 10px 12px !important;
    }
}

/* ============================================================
   GLOBAL VIEWPORT HEIGHT — Mobile Browser URL Bar Fix
   Use svh (smallest viewport height) when supported so the
   editor container never overflows behind the mobile browser's
   dynamic URL/tab bar.
   ============================================================ */
@supports (height: 100svh) {

    #otb-app,
    #otb-frontend-app {
        height: 100svh !important;
        max-height: 100svh !important;
    }
}

/* Touch-action: none on the Fabric.js canvas wrapper so the browser
   doesn't intercept two-finger pinch/pan before Fabric sees them */
.canvas-container {
    touch-action: none;
}

/* ============================================================
   CONTEXT STRIP — Contextual sub-toolbar (Stage 1 / 2)
   ============================================================ */

.otb-context-strip {
    height: 48px !important;
    background: #fff !important;
    border-bottom: 1px solid #e8e8e8 !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 10px !important;
    gap: 3px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    flex-shrink: 0 !important;
    z-index: 990 !important;
    scrollbar-width: none !important;
    position: relative !important;
}
.otb-context-strip::-webkit-scrollbar { display: none !important; }

/* Dividers */
.otb-strip-divider {
    width: 1px !important;
    height: 20px !important;
    background: #e0e0e0 !important;
    margin: 0 4px !important;
    flex-shrink: 0 !important;
    align-self: center !important;
}

/* Strip buttons */
.otb-strip-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 0 8px !important;
    height: 32px !important;
    border-radius: 5px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #333 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    transition: background 0.12s, color 0.12s !important;
    line-height: 1 !important;
}

/* Inline SVG icons in the strip — base size 16px, never smaller than 14px */
.otb-strip-btn svg {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
}
.otb-strip-btn:hover {
    background: #f0f0f0 !important;
}
.otb-strip-btn.otb-active {
    background: rgba(139, 61, 255, 0.1) !important;
    color: var(--otb-accent) !important;
}
.otb-strip-btn.otb-panel-open {
    background: rgba(139, 61, 255, 0.08) !important;
    color: var(--otb-accent) !important;
    outline: 1px solid rgba(139, 61, 255, 0.25) !important;
}
.otb-strip-btn.otb-strip-icon-only {
    padding: 0 !important;
    width: 32px !important;
    justify-content: center !important;
}
.otb-strip-btn.otb-strip-action-btn {
    font-weight: 600 !important;
    padding: 0 10px !important;
    border: 1px solid #e0e0e0 !important;
}
.otb-strip-btn .otb-strip-btn-label {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.otb-strip-info {
    font-size: 12px !important;
    color: #888 !important;
    padding: 0 6px !important;
    white-space: nowrap !important;
}

/* Inline font-size stepper */
.otb-strip-size-stepper {
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid #ddd !important;
    border-radius: 5px !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    height: 28px !important;
}
.otb-strip-size-btn {
    width: 22px !important;
    height: 28px !important;
    border: none !important;
    background: #f8f8f8 !important;
    color: #444 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    transition: background 0.1s !important;
}
.otb-strip-size-btn:hover { background: #e8e8e8 !important; }
.otb-strip-size-input {
    width: 38px !important;
    height: 28px !important;
    border: none !important;
    border-left: 1px solid #ddd !important;
    border-right: 1px solid #ddd !important;
    text-align: center !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #333 !important;
    background: #fff !important;
    padding: 0 !important;
    border-radius: 0 !important;
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}
.otb-strip-size-input::-webkit-outer-spin-button,
.otb-strip-size-input::-webkit-inner-spin-button { -webkit-appearance: none !important; margin: 0 !important; }

/* Reduce strip to icon-only on smaller viewports */
@media (max-width: 1200px) {
    /* Hide labels — only change is removing text */
    .otb-strip-btn .otb-strip-btn-label { display: none !important; }

    /* Icon-only button: use a square with enough room to tap comfortably.
       Width/height both 36px gives a 36×36px hit area.
       Remove the fixed 30px that was squishing icon + chevron together. */
    .otb-strip-btn {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        justify-content: center !important;
        gap: 3px !important;
    }

    /* Grow inline SVG icons inside the strip so they stay readable at 36px button.
       The SVG elements have width/height attributes of 13px set in JS — CSS wins here. */
    .otb-strip-btn svg {
        width: 16px !important;
        height: 16px !important;
        flex-shrink: 0 !important;
    }

    /* Shrink the chevron (▾) slightly relative to icon to keep balance */
    .otb-strip-btn svg:last-child {
        width: 10px !important;
        height: 10px !important;
    }

    /* Action buttons (Ungroup / Group / etc.) keep their text label but get taller */
    .otb-strip-btn.otb-strip-action-btn {
        width: auto !important;
        height: 36px !important;
        padding: 0 10px !important;
    }
    .otb-strip-btn.otb-strip-action-btn .otb-strip-btn-label { display: inline !important; }

    /* Raise strip height to match the taller buttons */
    .otb-context-strip {
        height: 50px !important;
        padding: 0 8px !important;
        gap: 3px !important;
    }

    /* Size stepper matches new height */
    .otb-strip-size-stepper {
        height: 32px !important;
    }
    .otb-strip-size-btn {
        width: 26px !important;
        height: 32px !important;
    }
    .otb-strip-size-input {
        height: 32px !important;
    }
}

/* Hide strip entirely on mobile — mobile uses existing bottom sheet */
@media (max-width: 768px) {
    .otb-context-strip { display: none !important; }
}

/* ============================================================
   FLOAT PANEL — Draggable anchored panel
   ============================================================ */

.otb-float-panel {
    position: fixed !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 10px !important;
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.14) !important;
    z-index: 9999000 !important;
    min-width: 240px !important;
    max-width: 360px !important;
    max-height: 90vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    font-size: 13px !important;
    color: #333 !important;
}

/* Panels whose content always fits — no scrollbar needed */
.otb-float-panel.otb-panel-fit {
    max-height: none !important;
}
.otb-float-panel.otb-panel-fit .otb-float-panel-body {
    overflow-y: visible !important;
}

.otb-float-panel-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 12px !important;
    background: #f8f8f8 !important;
    border-bottom: 1px solid #efefef !important;
    border-radius: 10px 10px 0 0 !important;
    user-select: none !important;
    flex-shrink: 0 !important;
}
.otb-float-panel-title {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #888 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}
.otb-float-panel-close {
    width: 20px !important;
    height: 20px !important;
    border: none !important;
    background: transparent !important;
    color: #aaa !important;
    cursor: pointer !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: color 0.1s, background 0.1s !important;
}
.otb-float-panel-close:hover { background: #eee !important; color: #555 !important; }

.otb-float-panel-body {
    overflow-y: auto !important;
    padding: 12px !important;
    flex: 1 !important;
    scrollbar-width: thin !important;
}

/* ── Panel internal components ── */

/* Rows */
.otb-panel-rows { display: flex !important; flex-direction: column !important; gap: 10px !important; }

.otb-panel-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 28px !important;
}
.otb-panel-row-label {
    font-size: 11px !important;
    color: #666 !important;
    font-weight: 500 !important;
    flex-shrink: 0 !important;
    min-width: 72px !important;
}
.otb-panel-row-val {
    font-size: 11px !important;
    color: #888 !important;
    min-width: 32px !important;
    text-align: right !important;
    flex-shrink: 0 !important;
}
.otb-panel-btn-row {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}
.otb-panel-sub {
    padding-left: 8px !important;
    border-left: 2px solid #f0f0f0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 4px !important;
}

/* Slider */
.otb-panel-slider {
    flex: 1 !important;
    height: 4px !important;
    border-radius: 4px !important;
    accent-color: var(--otb-accent) !important;
    cursor: pointer !important;
    min-width: 0 !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

/* Color swatch */
.otb-panel-color-swatch {
    width: 32px !important;
    height: 24px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    padding: 0 !important;
    cursor: pointer !important;
    background: transparent !important;
    flex-shrink: 0 !important;
}

/* Select */
.otb-panel-select {
    flex: 1 !important;
    font-size: 12px !important;
    border-radius: 5px !important;
    border: 1px solid #ddd !important;
    padding: 4px 6px !important;
    background: #fff !important;
    color: #333 !important;
    min-height: 28px !important;
    max-height: 28px !important;
}

/* Search input */
.otb-panel-search {
    width: 100% !important;
    font-size: 12px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    margin-bottom: 6px !important;
    background: #fff !important;
    color: #333 !important;
    min-height: 30px !important;
}
.otb-panel-search:focus { outline: 2px solid rgba(139,61,255,0.3) !important; border-color: var(--otb-accent) !important; }

/* Font panel */
.otb-panel-cat-row {
    display: flex !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding-bottom: 6px !important;
    margin-bottom: 4px !important;
    scrollbar-width: none !important;
}
.otb-panel-cat-row::-webkit-scrollbar { display: none !important; }
.otb-panel-cat-btn {
    padding: 3px 9px !important;
    border-radius: 10px !important;
    border: 1px solid #e0e0e0 !important;
    background: #fff !important;
    font-size: 11px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    color: #555 !important;
    transition: all 0.1s !important;
    flex-shrink: 0 !important;
}
.otb-panel-cat-btn.active { background: #ede8ff !important; border-color: var(--otb-accent) !important; color: var(--otb-accent) !important; }
.otb-panel-add-row { display: flex !important; gap: 6px !important; margin-bottom: 6px !important; }
.otb-panel-add-btn { padding: 0 10px !important; background: #f0f0f0 !important; border-radius: 5px !important; font-size: 12px !important; border: 1px solid #ddd !important; cursor: pointer !important; white-space: nowrap !important; height: 30px !important; color: #333 !important; }
.otb-panel-add-btn:hover { background: #e0e0e0 !important; }
.otb-panel-font-list { max-height: 240px !important; overflow-y: auto !important; border: 1px solid #eee !important; border-radius: 6px !important; }
.otb-panel-font-item { padding: 8px 10px !important; font-size: 14px !important; cursor: pointer !important; border-bottom: 1px solid #f5f5f5 !important; color: #333 !important; transition: background 0.1s !important; }
.otb-panel-font-item:hover { background: #f5f0ff !important; }
.otb-panel-font-item.selected { background: #ede8ff !important; color: var(--otb-accent) !important; font-weight: 600 !important; }
.otb-panel-font-more { padding: 8px 10px !important; font-size: 11px !important; color: #aaa !important; text-align: center !important; }

/* Icon grid (align, etc.) */
.otb-panel-icon-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
}
.otb-panel-icon-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    border-radius: 6px !important;
    border: 1px solid #e8e8e8 !important;
    background: #fafafa !important;
    cursor: pointer !important;
    font-size: 12px !important;
    color: #444 !important;
    transition: all 0.12s !important;
}
.otb-panel-icon-btn:hover { background: #f0ecff !important; border-color: var(--otb-accent) !important; color: var(--otb-accent) !important; }
.otb-panel-icon-btn.active { background: #ede8ff !important; border-color: var(--otb-accent) !important; color: var(--otb-accent) !important; }

/* Small icon buttons for arrange */
.otb-panel-icon-btn-sm {
    width: 32px !important;
    height: 32px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    background: #fafafa !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #444 !important;
    transition: all 0.12s !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}
.otb-panel-icon-btn-sm:hover { background: #f0ecff !important; border-color: var(--otb-accent) !important; color: var(--otb-accent) !important; }

/* Numeric inputs for position/size */
.otb-panel-num-label { display: flex !important; align-items: center !important; gap: 4px !important; font-size: 11px !important; color: #888 !important; }
.otb-panel-num-input {
    width: 52px !important;
    height: 28px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    text-align: center !important;
    font-size: 12px !important;
    color: #333 !important;
    background: #fff !important;
    padding: 0 4px !important;
}

/* Action list (More panel) */
.otb-panel-action-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 8px 10px !important;
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    font-size: 13px !important;
    color: #333 !important;
    text-align: left !important;
    transition: background 0.1s !important;
}
.otb-panel-action-btn:hover { background: #f5f5f5 !important; }
.otb-panel-action-btn.danger { color: #d63031 !important; }
.otb-panel-action-btn.danger:hover { background: #fff5f5 !important; }

/* Toggle switch */
.otb-panel-toggle-label {
    display: inline-flex !important;
    align-items: center !important;
    cursor: pointer !important;
    gap: 0 !important;
    position: relative !important;
}
.otb-panel-toggle-label input[type="checkbox"] { display: none !important; }
.otb-panel-toggle-track {
    width: 34px !important;
    height: 18px !important;
    background: #ddd !important;
    border-radius: 20px !important;
    position: relative !important;
    transition: background 0.2s !important;
    display: block !important;
}
.otb-panel-toggle-track::after {
    content: '' !important;
    position: absolute !important;
    width: 14px !important;
    height: 14px !important;
    background: #fff !important;
    border-radius: 50% !important;
    top: 2px !important;
    left: 2px !important;
    transition: left 0.2s !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}
.otb-panel-toggle-label input:checked + .otb-panel-toggle-track { background: var(--otb-accent) !important; }
.otb-panel-toggle-label input:checked + .otb-panel-toggle-track::after { left: 18px !important; }

/* Fill panel */
.otb-panel-fill-wrap { display: flex !important; flex-direction: column !important; gap: 10px !important; }

/* ─── Curve Panel ─── */
.otb-curve-panel { min-width: 220px !important; }
.otb-curve-header { justify-content: center !important; }
.otb-curve-tabs { gap: 4px !important; flex-wrap: wrap !important; }
.otb-curve-flip-row { justify-content: space-between !important; }

.otb-btn-sm {
    font-size: 11px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    background: #f5f5f5 !important;
    cursor: pointer !important;
    color: #333 !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
}
.otb-btn-sm:hover { background: #e8e8e8 !important; }
.otb-btn-sm.active { background: var(--otb-accent) !important; color: #fff !important; border-color: var(--otb-accent) !important; }

.otb-tab-btn {
    font-size: 11px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    background: #f5f5f5 !important;
    cursor: pointer !important;
    color: #555 !important;
    flex: 1 !important;
    text-align: center !important;
}
.otb-tab-btn:hover { background: #e8e8e8 !important; }
.otb-tab-btn.active { background: var(--otb-accent) !important; color: #fff !important; border-color: var(--otb-accent) !important; font-weight: 600 !important; }

/* ── Search result card for otb_template posts ─────────────────────────────── */
.otb-search-card {
    margin: 12px 0 0;
}
.otb-search-card__thumb-link {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    line-height: 0;
    text-decoration: none !important;
}
.otb-search-card__thumb {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    transition: opacity 0.2s ease;
}
.otb-search-card__thumb-link:hover .otb-search-card__thumb {
    opacity: 0.85;
}
.otb-search-card__new-tab-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 12px;
    line-height: 1.3;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 0 0 6px 6px;
}
.otb-search-card__thumb-link:hover .otb-search-card__new-tab-hint {
    opacity: 1;
}
.otb-search-card__customize-btn {
    width: 100% !important;
    justify-content: center !important;
    margin-top: 8px !important;
}