/* 
 * Truelysell Gutenberg Block Editor Stylesheet (Plugin Asset)
 * Native editor styling, container rules, and interactive block controls
 */

.editor-styles-wrapper {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #272b41;
    background-color: #ffffff;
}

/* Allow Gutenberg editor canvas to use full available width */
.editor-styles-wrapper .wp-block,
.editor-styles-wrapper .is-root-container > .wp-block,
.editor-styles-wrapper .block-editor-block-list__layout.is-root-container {
    max-width: 100% !important;
    width: 100% !important;
}

.editor-styles-wrapper .wp-block[data-align="full"],
.editor-styles-wrapper .wp-block.alignfull {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.wp-block[data-type^="truelysell/"],
.editor-styles-wrapper .wp-block[data-type^="truelysell/"] {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    clear: both;
}

/* ==========================================================================
   Server-side render block preview & Container styling
   ========================================================================== */

.truelysell-gutenberg-block-wrapper,
.truelysell-gutenberg-block-container,
.truelysell-gutenberg-block-editor-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 24px;
    background: transparent;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.truelysell-gutenberg-block-wrapper .components-server-side-render,
.truelysell-gutenberg-block-wrapper .wp-block-server-side-render,
.truelysell-ssr-wrapper .components-server-side-render,
.truelysell-ssr-wrapper .wp-block-server-side-render {
    pointer-events: none;
    user-select: none;
    width: 100%;
    overflow: hidden;
}

/* When boxed container mode is enabled (Full Width Container set to OFF / boxed) */
.truelysell-gutenberg-block-output.truelysell-boxed-section,
.editor-styles-wrapper .truelysell-gutenberg-block-output.truelysell-boxed-section,
.wp-block.truelysell-boxed-section {
    max-width: 1320px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.truelysell-gutenberg-block-output.truelysell-boxed-section > section,
.truelysell-gutenberg-block-output.truelysell-boxed-section > div,
.truelysell-gutenberg-block-output.truelysell-boxed-section .categories-boxes-container,
.truelysell-gutenberg-block-output.truelysell-boxed-section .section-heading {
    max-width: 100% !important;
}

/* When fullwidth container is enabled */
.truelysell-gutenberg-block-container.is-fullwidth,
.truelysell-gutenberg-block-container.alignfull,
.truelysell-gutenberg-block-container[data-align="full"],
.truelysell-gutenberg-block-wrapper.is-fullwidth,
.truelysell-gutenberg-block-wrapper.alignfull,
.truelysell-gutenberg-block-output.truelysell-fullwidth-section,
.truelysell-gutenberg-block-output.alignfull {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.truelysell-gutenberg-block-container.is-fullwidth .truelysell-ssr-wrapper,
.truelysell-gutenberg-block-container.alignfull .truelysell-ssr-wrapper,
.truelysell-gutenberg-block-wrapper.is-fullwidth .components-server-side-render {
    width: 100% !important;
    max-width: 100% !important;
}

/* Compact view mode for centered, proportional preview (when manually toggled) */
.truelysell-gutenberg-block-container.is-compact-view .truelysell-ssr-wrapper {
    max-width: 1200px !important;
    margin: 0 auto !important;
    border-left: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.truelysell-ssr-wrapper .components-server-side-render,
.truelysell-ssr-wrapper .wp-block-server-side-render {
    pointer-events: none;
    user-select: none;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Section and Grid Container Rules inside SSR */
.truelysell-ssr-wrapper section {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.truelysell-ssr-wrapper .container {
    max-width: 1140px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    box-sizing: border-box !important;
}

.truelysell-ssr-wrapper .container-fluid {
    width: 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    box-sizing: border-box !important;
}

.truelysell-ssr-wrapper .row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-left: -15px !important;
    margin-right: -15px !important;
    box-sizing: border-box !important;
}

.truelysell-ssr-wrapper [class*="col-"] {
    position: relative;
    width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
}

.truelysell-ssr-wrapper .col-lg-6,
.truelysell-ssr-wrapper .col-md-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
}

.truelysell-ssr-wrapper .col-lg-12,
.truelysell-ssr-wrapper .col-md-12 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

.truelysell-ssr-wrapper .col-lg-4,
.truelysell-ssr-wrapper .col-md-4 {
    flex: 0 0 33.333333% !important;
    max-width: 33.333333% !important;
}

.truelysell-ssr-wrapper .col-lg-3,
.truelysell-ssr-wrapper .col-md-3 {
    flex: 0 0 25% !important;
    max-width: 25% !important;
}

.truelysell-ssr-wrapper .col-lg-8 {
    flex: 0 0 66.666667% !important;
    max-width: 66.666667% !important;
}

/* Alignment utilities inside SSR */
.truelysell-ssr-wrapper .align-items-center {
    align-items: center !important;
}

.truelysell-ssr-wrapper .justify-content-center {
    justify-content: center !important;
}

.truelysell-ssr-wrapper .justify-content-between {
    justify-content: space-between !important;
}

.truelysell-ssr-wrapper .d-flex {
    display: flex !important;
}

.truelysell-ssr-wrapper .d-md-flex {
    display: flex !important;
}

.truelysell-ssr-wrapper .text-center {
    text-align: center !important;
}

.truelysell-ssr-wrapper .mx-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

.truelysell-ssr-wrapper .img-fluid {
    max-width: 100%;
    height: auto;
}

/* Fix hero-section-ten and banner graphics positioning inside editor */
.truelysell-ssr-wrapper .hero-section-ten {
    position: relative;
    overflow: hidden;
    padding: 60px 0;
}

.truelysell-ssr-wrapper .banner-imgs-ten {
    position: relative;
    text-align: center;
}

.truelysell-ssr-wrapper .banner-imgs-ten img {
    max-width: 100%;
    height: auto;
}

/* In-canvas editing form */
.truelysell-block-inline-edit-form {
    background: #f8fafc;
    border-top: none;
    padding: 24px;
}

.truelysell-block-inline-edit-header {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 14px;
    margin-bottom: 22px;
}

.truelysell-block-inline-edit-header h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.truelysell-block-inline-edit-header p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.truelysell-block-inline-edit-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px 22px;
    margin-bottom: 24px;
}

.truelysell-block-inline-edit-fields .components-base-control {
    margin-bottom: 0;
}

.truelysell-block-inline-edit-fields .components-base-control__label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    color: #334155;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.truelysell-block-inline-edit-fields input[type="text"],
.truelysell-block-inline-edit-fields select,
.truelysell-block-inline-edit-fields textarea {
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    color: #1e293b !important;
    line-height: 1.5 !important;
}

.truelysell-block-inline-edit-fields input[type="text"]:focus,
.truelysell-block-inline-edit-fields select:focus,
.truelysell-block-inline-edit-fields textarea:focus {
    border-color: #f35b37 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(243, 91, 55, 0.25) !important;
}

.truelysell-block-inline-edit-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
}

.truelysell-block-inline-edit-footer .components-button {
    background: #f35b37 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    padding: 8px 18px !important;
    border-radius: 6px !important;
    height: auto !important;
}

.truelysell-block-inline-edit-footer .components-button:hover {
    background: #d94826 !important;
}

/* Media Upload Control Styling */
.truelysell-media-field-group {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.truelysell-media-field-group:hover {
    border-color: #cbd5e1;
}

.truelysell-media-thumb-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px;
    text-align: center;
    margin-bottom: 8px;
}

.truelysell-media-thumb-preview img {
    max-width: 100%;
    max-height: 120px;
    border-radius: 4px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Icon-type media fields show smaller preview */
.truelysell-media-field-group.is-icon-field .truelysell-media-thumb-preview img {
    max-height: 48px;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 8px;
}

/* Media upload button styling */
.truelysell-media-field-group .components-button.is-secondary {
    width: 100%;
    justify-content: center;
    font-size: 12px;
    padding: 6px 12px;
    height: auto;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 4px;
}

/* Inspector sidebar: group icon fields visually */
.block-editor-block-inspector .truelysell-media-field-group + .truelysell-media-field-group {
    margin-top: 10px;
}

/* Fallback & preview notification boxes */
.truelysell-block-fallback,
.truelysell-block-preview {
    padding: 20px;
    background: #f35b37;
    color: #ffffff;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
}

.truelysell-block-error {
    padding: 15px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    font-size: 13px;
}

/* Ensure carousels in editor preview don't collapse or overflow */
.truelysell-gutenberg-block-container .owl-carousel:not(.owl-loaded),
.truelysell-gutenberg-block-editor-wrapper .owl-carousel:not(.owl-loaded),
.truelysell-gutenberg-block-editor-wrapper .slick-slider:not(.slick-initialized) {
    display: flex;
    overflow-x: auto;
    gap: 20px;
}

.truelysell-gutenberg-block-container .owl-carousel:not(.owl-loaded) > div,
.truelysell-gutenberg-block-editor-wrapper .owl-carousel:not(.owl-loaded) > div,
.truelysell-gutenberg-block-editor-wrapper .slick-slider:not(.slick-initialized) > div {
    min-width: 280px;
    flex: 0 0 auto;
}

/* Repeater Item Boxes in Inspector Controls & Edit Form */
.truelysell-repeater-item-box {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.truelysell-repeater-item-box:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.truelysell-repeater-item-box .components-base-control {
    margin-bottom: 10px;
}

.truelysell-repeater-item-box .components-base-control__label {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #475569 !important;
    margin-bottom: 4px !important;
}

.truelysell-repeater-item-box .components-text-control__input,
.truelysell-repeater-item-box .components-textarea-control__input {
    font-size: 12px !important;
    border-radius: 4px !important;
}

