/* ============================================================
   HOME BUILDER — Free-Form Canvas Builder Styles
   Admin-only CMS inside HUB Settings.
   Users place and resize blocks freely on a canvas.
   ============================================================ */

/* ==================== TOOLBAR ==================== */
.hb-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.hb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.hb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== STATUS BADGE ==================== */
.hb-status-badge {
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 12px;
    white-space: nowrap;
    font-family: 'Futura PT', 'Jost', sans-serif;
}

.hb-status-badge.hb-status-draft { background: #fff3cd; color: #856404; }
.hb-status-badge.hb-status-dirty { background: #fff3cd; color: #856404; }
.hb-status-badge.hb-status-unpublished { background: #fce8c8; color: #7c5200; }
.hb-status-badge.hb-status-published { background: #d4edda; color: #155724; }

/* ==================== LAYOUT NAME (inline editable) ==================== */
.hb-layout-name-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 260px;
}
.hb-layout-name-input {
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #231F20;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 6px;
    padding: 4px 8px;
    outline: none;
    width: 100%;
    min-width: 100px;
    transition: border-color 0.2s, background 0.2s;
}
.hb-layout-name-input:hover {
    border-color: #e0ddd8;
    background: #faf9f7;
}
.hb-layout-name-input:focus {
    border-color: #1E6332;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30, 99, 50, 0.1);
}
.hb-layout-name-icon {
    font-size: 11px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
    flex-shrink: 0;
}
.hb-layout-name-icon:hover { color: #1E6332; }

/* ==================== GLOBAL SETTINGS POPOVER ==================== */
.hb-global-settings-popover {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 0 0 1px rgba(0,0,0,0.05);
    width: 270px;
    overflow: hidden;
}
.hb-gs-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f8f7f5;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Futura PT', 'Jost', sans-serif;
    border-bottom: 1px solid #eee;
}
.hb-gs-body {
    padding: 14px 16px 16px;
}
.hb-gs-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
    margin-top: 10px;
}
.hb-gs-label:first-child { margin-top: 0; }
.hb-gs-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hb-gs-color {
    width: 36px;
    height: 30px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    padding: 1px;
    flex-shrink: 0;
}

/* ==================== BUTTONS ==================== */
.hb-btn {
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.hb-btn:hover { transform: translateY(-1px); }
.hb-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.hb-btn-outline {
    background: transparent;
    border: 1px solid #ccc;
    color: #666;
}
.hb-btn-outline:hover { border-color: #1E6332; color: #1E6332; }

.hb-btn-snap-on {
    background: #1E633215;
    border-color: #1E6332;
    color: #1E6332;
}

.hb-btn-secondary { background: #f0f0f0; color: #333; }
.hb-btn-secondary:hover { background: #e0e0e0; }

.hb-btn-primary { background: linear-gradient(135deg, #1E6332, #2F8542); color: #fff; }
.hb-btn-primary:hover { background: linear-gradient(135deg, #214A3E, #1E6332); }

.hb-btn-sm { padding: 5px 12px; font-size: 12px; }
.hb-btn-xs { padding: 3px 8px; font-size: 11px; }

.hb-btn-danger-outline { border-color: #dc3545; color: #dc3545; background: transparent; }
.hb-btn-danger-outline:hover { background: #fee2e2; border-color: #b02a37; color: #b02a37; }

/* ==================== ICON BUTTONS ==================== */
.hb-btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    color: #888;
}
.hb-btn-icon:hover { background: #f0f0f0; }
.hb-btn-icon-xs { width: 22px; height: 22px; font-size: 10px; }
.hb-btn-danger-icon { color: #dc3545; }
.hb-btn-danger-icon:hover { background: #fee2e2; color: #b02a37; }

/* ==================== TOGGLE BUTTONS ==================== */
.hb-btn-group {
    display: flex;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.hb-btn-toggle {
    flex: 1;
    padding: 7px 14px;
    border: none;
    background: #fff;
    color: #666;
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    border-right: 1px solid #ddd;
}
.hb-btn-toggle:last-child { border-right: none; }
.hb-btn-toggle:hover { background: #f8f8f8; }
.hb-btn-toggle-active,
.hb-btn-toggle.hb-btn-toggle-active { background: #1E6332; color: #fff; }
.hb-btn-toggle-active:hover { background: #214A3E; }

/* ==================== WORKSPACE (canvas + push-based props panel) ==================== */
.hb-workspace {
    display: flex;
    align-items: flex-start;
    gap: 0;
}

.hb-canvas-wrap {
    flex: 1;
    min-width: 0;
    transition: flex 0.25s ease;
}

/* ==================== CANVAS HEIGHT BAR ==================== */
.hb-canvas-height-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: #fafaf8;
    border: 1px solid #e8e4df;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    font-size: 13px;
    color: #777;
    font-family: 'Futura PT', 'Jost', sans-serif;
}

/* ==================== CANVAS ==================== */
.hb-canvas {
    position: relative;
    background: #fff;
    border: 2px dashed #c4c0bb;
    border-radius: 0 0 10px 10px;
    overflow: visible;
    cursor: default;
    min-height: 400px;
    background-image:
        linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 10px 10px;
}

/* ==================== BLOCK ==================== */
.hb-block {
    position: absolute;
    border: 2px solid #d4d0cb;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    cursor: move;
    transition: box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}

.hb-block:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border-color: #bbb;
}

.hb-block-selected {
    border-color: #1E6332 !important;
    box-shadow: 0 0 0 3px rgba(30, 99, 50, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1) !important;
}

/* Block label bar */
.hb-block-label {
    padding: 7px 14px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Futura PT', 'Jost', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    user-select: none;
}

/* Block content preview */
.hb-block-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Quick action buttons (top-right corner) */
.hb-block-quick-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.hb-block:hover .hb-block-quick-actions {
    opacity: 1;
}

.hb-block-qbtn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: rgba(255,255,255,0.95);
    color: #555;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    transition: background 0.15s ease;
}

.hb-block-qbtn:hover { background: #f0f0f0; }
.hb-block-qbtn-danger:hover { background: #fee2e2; color: #dc3545; }

/* ==================== RESIZE HANDLES ==================== */
.hb-handle {
    position: absolute;
    z-index: 10;
    background: #1E6332;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.hb-handle-nw { top: -6px; left: -6px; cursor: nw-resize; }
.hb-handle-n  { top: -6px; left: 50%; margin-left: -6px; cursor: n-resize; }
.hb-handle-ne { top: -6px; right: -6px; cursor: ne-resize; }
.hb-handle-e  { top: 50%; right: -6px; margin-top: -6px; cursor: e-resize; }
.hb-handle-se { bottom: -6px; right: -6px; cursor: se-resize; }
.hb-handle-s  { bottom: -6px; left: 50%; margin-left: -6px; cursor: s-resize; }
.hb-handle-sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.hb-handle-w  { top: 50%; left: -6px; margin-top: -6px; cursor: w-resize; }

/* ==================== BLOCK CONTENT PREVIEWS ==================== */
.hb-preview-empty {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 14px;
    gap: 8px;
}
.hb-preview-empty i { font-size: 28px; }

.hb-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.hb-preview-hero {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    padding: 16px;
}
.hb-preview-hero-h { font-size: 20px; font-weight: 700; margin-bottom: 4px; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.hb-preview-hero-sub { font-size: 14px; opacity: 0.85; margin-bottom: 8px; }
.hb-preview-hero-cta { font-size: 13px; background: rgba(255,255,255,0.9); color: #1E6332; padding: 6px 18px; border-radius: 6px; font-weight: 600; }

.hb-preview-richtext {
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #555;
    overflow: hidden;
}
.hb-preview-richtext h1, .hb-preview-richtext h2, .hb-preview-richtext h3 { font-size: 16px; color: #1E6332; margin: 4px 0; }
.hb-preview-richtext img { max-width: 100%; border-radius: 4px; }

.hb-preview-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
}

.hb-preview-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 6px;
    width: 100%;
    height: 100%;
}
.hb-preview-gallery-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
}
.hb-preview-gallery-ph {
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #ccc;
}
.hb-preview-gallery-more {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #888;
    font-size: 14px;
    font-weight: 600;
}

/* ==================== NEW TYPE PREVIEWS ==================== */
.hb-preview-video {
    height: 100%;
    display: flex;
    flex-direction: column;
}
.hb-preview-video-thumb {
    flex: 1;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    position: relative;
}
.hb-preview-video-thumb i {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.hb-preview-video-thumb span {
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
}
.hb-preview-video-cap {
    padding: 4px 8px;
    font-size: 11px;
    color: #666;
    background: #f9f9f9;
    text-align: center;
}
.hb-preview-embed {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f0f7ff;
    border-radius: 6px;
    padding: 12px;
}

/* ==================== PROPS PANEL CLOSE BUTTON ==================== */
.hb-props-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.hb-props-close:hover { background: #f0f0f0; }

/* ==================== PROPERTIES PANEL (push-based, compresses canvas) ==================== */
.hb-props-panel {
    width: 0;
    overflow: hidden;
    background: #fff;
    border-left: none;
    flex-shrink: 0;
    transition: width 0.25s ease, border-left 0.25s ease;
    align-self: stretch;
    min-height: 400px;
}

.hb-props-panel-open {
    width: 340px;
    border-left: 1px solid #e8e4df;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
}

.hb-props-panel-inner {
    padding-top: 0;
    width: 340px;
    min-width: 340px;
}

.hb-props-empty {
    padding: 40px 20px;
    text-align: center;
    color: #aaa;
    display: none; /* Panel is hidden entirely when no block selected */
    flex-direction: column;
    align-items: center;
    font-size: 13px;
}

.hb-props-header {
    display: flex;
    align-items: center;
    padding: 16px 18px;
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #231F20;
    border-bottom: 1px solid #f0ede8;
}

.hb-props-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hb-props-section {
    padding: 16px 18px;
    border-bottom: 1px solid #f0ede8;
}
.hb-props-section:last-child { border-bottom: none; }

.hb-props-section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 12px;
    font-family: 'Futura PT', 'Jost', sans-serif;
}

.hb-props-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.hb-prop-field label {
    display: block;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
    font-family: 'Futura PT', 'Jost', sans-serif;
    text-transform: uppercase;
}

.hb-props-danger-zone {
    text-align: center;
    padding: 16px;
}

/* Layer buttons */
.hb-layer-btns {
    display: flex;
    gap: 6px;
}

/* ==================== FORM FIELDS ==================== */
.hb-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 13px;
    color: #333;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}
.hb-input:focus { border-color: #1E6332; outline: none; box-shadow: 0 0 0 3px rgba(30,99,50,0.1); }
.hb-input-sm { padding: 6px 8px; font-size: 12px; }
.hb-input-xs { padding: 4px 6px; font-size: 12px; }

.hb-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 13px;
    color: #333;
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
}
.hb-textarea:focus { border-color: #1E6332; outline: none; box-shadow: 0 0 0 3px rgba(30,99,50,0.1); }

.hb-field-row {
    margin-bottom: 12px;
}
.hb-field-row label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 5px;
    font-family: 'Futura PT', 'Jost', sans-serif;
}

.hb-field-row-group {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}
.hb-field-half { flex: 1; min-width: 0; margin-bottom: 0; }

.hb-color-field {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hb-color-field input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}
.hb-color-field span { font-size: 12px; color: #888; }

.hb-range-field {
    display: flex;
    align-items: center;
    gap: 10px;
}
.hb-range-field input[type="range"] { flex: 1; accent-color: #1E6332; }
.hb-range-field span { font-size: 12px; color: #888; min-width: 36px; text-align: right; }

/* ==================== EDITOR FIELDS ==================== */
.hb-editor-fields {
    padding: 0;
}

/* Section separator in editor panel */
.hb-editor-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8c8680;
}
.hb-editor-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8e4df;
}

.hb-img-preview-wrap {
    position: relative;
    margin-bottom: 12px;
    text-align: center;
    background: #fafaf8;
    border-radius: 8px;
    padding: 10px;
}
.hb-img-preview {
    max-width: 100%;
    max-height: 160px;
    border-radius: 6px;
    object-fit: contain;
}
.hb-img-preview-wrap .hb-btn-icon {
    position: absolute;
    top: 6px;
    right: 6px;
}
.hb-img-loading {
    padding: 30px;
    text-align: center;
    color: #1E6332;
    font-size: 18px;
}

/* Rich text editor */
.hb-rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
    background: #fafaf8;
    border: 1px solid #e8e4df;
    border-radius: 6px 6px 0 0;
    align-items: center;
}

.hb-rte-toolbar button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hb-rte-toolbar button:hover { background: #e8e4df; }

.hb-rte-toolbar select {
    padding: 3px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    color: #555;
    background: #fff;
    cursor: pointer;
}

.hb-rte-sep {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 2px;
}

.hb-rte-editor {
    border: 1px solid #e8e4df;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 12px;
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    outline: none;
}
.hb-rte-editor:focus { box-shadow: 0 0 0 3px rgba(30,99,50,0.1); }

/* Gallery editor */
.hb-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-width: 100%;
    overflow: hidden;
}

.hb-gallery-item {
    border: 1px solid #e8e4df;
    border-radius: 8px;
    overflow: hidden;
    background: #fafaf8;
}

.hb-gallery-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.hb-gallery-thumb-placeholder {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.hb-gallery-item-actions {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hb-empty-hint {
    color: #aaa;
    font-size: 13px;
    font-style: italic;
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px 0;
}

/* ==================== STARTER SCREEN ==================== */
.hb-starter {
    text-align: center;
    padding: 40px 20px;
}

.hb-starter-header {
    margin-bottom: 30px;
}

.hb-starter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

.hb-starter-card {
    background: #fff;
    border: 1px solid #e8e4df;
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}
.hb-starter-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }

.hb-starter-thumb {
    position: relative;
    height: 140px;
    background: #fafaf8;
    border-bottom: 1px solid #f0ede8;
    overflow: hidden;
}
.hb-starter-thumb-sm { height: 90px; }
.hb-starter-thumb-scratch {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hb-thumb-block {
    position: absolute;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hb-thumb-label {
    font-size: 7px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 2px;
}

.hb-starter-info {
    padding: 12px;
    text-align: left;
}
.hb-starter-info strong {
    display: block;
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 14px;
    color: #231F20;
    margin-bottom: 2px;
}
.hb-starter-info span {
    font-size: 12px;
    color: #888;
}

.hb-starter-card-sm { padding: 0; }
.hb-starter-card-sm .hb-starter-info { padding: 8px; text-align: center; }

/* ==================== TEMPLATE OVERLAY ==================== */
.hb-template-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hb-template-modal {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    max-width: 1000px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.hb-template-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hb-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

/* Template card (enhanced) */
.hb-tpl-card {
    background: #fff;
    border: 1px solid #e8e4df;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    overflow: hidden;
}
.hb-tpl-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(30,99,50,0.08); border-color: #1E633240; }

.hb-tpl-card-saved { border-color: #C19A6B40; }
.hb-tpl-card-saved:hover { border-color: #C19A6B80; box-shadow: 0 6px 20px rgba(193,154,107,0.12); }

.hb-tpl-thumb {
    position: relative;
    height: 110px;
    background: linear-gradient(135deg, #fafaf8 0%, #f4f2ef 100%);
    border-bottom: 1px solid #f0ede8;
    overflow: hidden;
    padding: 6px;
}
.hb-tpl-thumb .hb-thumb-block {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hb-tpl-info { padding: 10px 12px; }

.hb-tpl-name {
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #231F20;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
}

.hb-tpl-desc {
    font-size: 11px;
    color: #888;
    line-height: 1.35;
    margin-bottom: 6px;
}

.hb-tpl-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.hb-tpl-chip {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
}
.hb-tpl-chip i { font-size: 9px; }
.hb-tpl-chip-more {
    color: #999;
    background: #f5f5f5;
    border-color: #e5e5e5;
}

.hb-tpl-count {
    font-size: 10px;
    color: #aaa;
    font-weight: 500;
}

/* Template section headers */
.hb-tpl-section { margin-bottom: 20px; }
.hb-tpl-section-header {
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #475453;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.hb-tpl-section-count {
    background: #f0ede8;
    color: #666;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* Save layout bar */
.hb-tpl-save-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #F4F0E9;
    border: 1px dashed #C19A6B60;
    border-radius: 10px;
    margin-bottom: 20px;
}

/* Saved layout delete button */
.hb-tpl-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: rgba(220,38,38,0.08);
    color: #dc2626;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
    z-index: 2;
}
.hb-tpl-card:hover .hb-tpl-delete { opacity: 1; }
.hb-tpl-delete:hover { background: rgba(220,38,38,0.15); }

/* ==================== CHANGE TYPE MENU ==================== */
.hb-change-type-menu {
    background: #fff;
    border: 1px solid #e8e4df;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    padding: 8px;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    animation: hbFadeIn 0.12s ease;
}
.hb-change-type-header {
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #475453;
    padding: 6px 8px 8px;
    border-bottom: 1px solid #f0ede8;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}
.hb-change-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}
.hb-change-type-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #444;
    transition: background 0.1s ease;
    text-align: left;
}
.hb-change-type-item:hover { background: #F4F0E9; }
.hb-change-type-item i { font-size: 14px; width: 18px; text-align: center; }
.hb-change-type-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-change-type-active {
    background: #1E633212;
    font-weight: 600;
    color: #1E6332;
}

/* Change type quick button styling */
.hb-block-qbtn-change {
    background: rgba(30,99,50,0.08) !important;
    color: #1E6332 !important;
}
.hb-block-qbtn-change:hover {
    background: rgba(30,99,50,0.18) !important;
}

/* ==================== TYPE PICKER ==================== */
.hb-type-picker-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: hbFadeIn 0.15s ease;
}

@keyframes hbFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hb-type-picker {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    max-width: 820px;
    width: 100%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    animation: hbScaleIn 0.2s ease;
    max-height: 85vh;
    overflow-y: auto;
}

@keyframes hbScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.hb-type-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.hb-type-picker-header h3 {
    margin: 0;
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 18px;
    color: #231F20;
}

.hb-type-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.hb-type-picker-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    border: 1px solid #e8e4df;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    text-align: center;
    width: 100%;
}
.hb-type-picker-btn:hover { background: #fafaf8; border-color: #1E6332; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(30, 99, 50, 0.12); }

.hb-type-picker-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.hb-type-picker-info {
    min-width: 0;
}
.hb-type-picker-info strong {
    display: block;
    font-family: 'Futura PT', 'Jost', sans-serif;
    font-size: 13px;
    color: #231F20;
    margin-bottom: 2px;
}
.hb-type-picker-info span {
    font-size: 11px;
    color: #888;
    line-height: 1.3;
    display: block;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
    .hb-props-panel-open {
        width: 280px;
    }
    .hb-props-panel-inner {
        width: 280px;
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .hb-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .hb-toolbar-right {
        width: 100%;
        justify-content: flex-end;
    }
    .hb-layout-name-wrap {
        max-width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }
    .hb-layout-name-input {
        font-size: 14px;
    }
    .hb-global-settings-popover {
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
    }
    .hb-starter-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .hb-template-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    .hb-template-modal {
        max-width: 100%;
        padding: 16px;
    }
    .hb-tpl-save-bar {
        flex-wrap: wrap;
    }
    .hb-change-type-menu {
        width: 280px;
    }
    .hb-tpl-delete { opacity: 1; }
    .hb-type-picker {
        max-width: 100%;
    }
    .hb-type-picker-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hb-props-grid {
        grid-template-columns: 1fr 1fr;
    }
    .hb-block-label {
        font-size: 11px;
        padding: 4px 8px;
    }
    .hb-handle {
        width: 16px;
        height: 16px;
    }
    .hb-handle-nw { top: -8px; left: -8px; }
    .hb-handle-n  { top: -8px; margin-left: -8px; }
    .hb-handle-ne { top: -8px; right: -8px; }
    .hb-handle-e  { right: -8px; margin-top: -8px; }
    .hb-handle-se { bottom: -8px; right: -8px; }
    .hb-handle-s  { bottom: -8px; margin-left: -8px; }
    .hb-handle-sw { bottom: -8px; left: -8px; }
    .hb-handle-w  { left: -8px; margin-top: -8px; }

    /* Quick actions always visible on touch devices */
    .hb-block-quick-actions {
        opacity: 1;
    }
}
