/**
 * Widget Studio Universal Layout – Structural + variant styles
 * Version: 1.4.0 (2026-08-16 – Fix split-box side-by-side via .ws-flex-responsive)
 * Last modified: 2026-08-16
 *
 * CLEAN ARCHITECTURE NOTES:
 * - This file contains ONLY structural, layout, and variant modifier styles.
 * - All colors, typography, spacing and radii MUST come from assets/css/base/variables.css
 *   via CSS custom properties (var(--...)). No hardcoded design values.
 * - Border styles were migrated from universal-layout.html.twig so Twig remains
 *   a 100 % pure structural renderer.
 *
 * PHASE 1 (v1.2.1) – Dual border system is intentional and documented:
 *   1. Outer box          → registry class (ws-border-*)
 *      Emitted by Twig as border_style_class (Control Options Registry).
 *   2. Inner T-shape      → structural class (border-style-*)
 *      Emitted by Twig only when border_style ≠ "none".
 *      Required by the pros/cons below-split visual.
 * Both families must stay until a future single-class migration is coordinated
 * with the Control Options Registry and design-system tokens.
 *
 * v1.2.2 – Root + flex containment (mobile right overflow)
 * v1.2.3 – Table / html-field containment (scroll inside padded parent)
 */

.ws-universal-layout {
    --ws-desktop: var(--ws-bp-desktop);
    --ws-tablet: var(--ws-bp-tablet);
    --ws-mobile: var(--ws-bp-mobile);

    /* Contain within parent padding box – fixes mobile right overflow */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ==========================================
   NEW SEMANTIC LAYOUT CLASSES (Phase 15/5/1)
   ========================================== */
.ws-split-col {
    flex: 1 1 50%;
    min-width: 0;
    box-sizing: border-box;
}

/* Split / multi-column row – parent must be flex (Twig: ws-flex-responsive) */
.ws-flex-responsive {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

@media (min-width: 768px) {
    .ws-flex-responsive {
        flex-direction: row;
    }
}

/* Generic N-column layouts from box_schema.columns */
.ws-generic-columns {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

.ws-generic-columns > .ws-generic-col,
.ws-generic-columns > .ws-split-col {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .ws-generic-columns {
        flex-direction: row;
    }
}

/* Ensure split-box outer shell does not force column stacking */
.ws-box-split > .ws-content-wrapper.ws-flex-responsive {
    display: flex;
}

.ws-col-pad {
    padding: var(--ws-col-pad);
}

@media (max-width: 1024px) {
    .ws-col-pad {
        padding: var(--ws-col-pad-tablet);
    }
}

@media (max-width: 767px) {
    .ws-col-pad {
        padding: var(--ws-col-pad-mobile);
    }
}

/* ==========================================
   EXISTING STYLES (unchanged behaviour)
   ========================================== */
.ws-universal-layout .ws-image-left-split,
.ws-universal-layout .ws-below-split {
    display: flex !important;
    flex-direction: column !important;
}

@media (min-width: 768px) {
    .ws-universal-layout .ws-image-left-split,
    .ws-universal-layout .ws-below-split {
        flex-direction: row !important;
    }
}

.ws-image-left-split__image-column,
.ws-image-left-split__right-column,
.ws-below-split > div {
    flex: 1;
    min-width: 0; /* allow flex children to shrink – prevents overflow */
    box-sizing: border-box;
}

.ws-image-left-split__image-column {
    aspect-ratio: 1 / 1;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--ws-image-radius);
}

.ws-product-image {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block;
}

.ws-buttons-group {
    display: flex;
    flex-direction: column;
    gap: var(--ws-layout-gap);
    margin: 1.25rem 0 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.ws-buttons-group .ws-button {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    box-sizing: border-box;
}

/* ==========================================
   PRODUCT NUMBER STYLES
   (Pure token colours – visual result identical)
   ========================================== */
.ws-product-number {
    display: inline-block;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 400;
    line-height: 1;
}

.ws-product-number--filled {
    font-size: var(--ws-product-number-size);
    background: var(--color-charcoal);
    color: var(--color-white);
    padding: var(--ws-product-number-pad-y) var(--ws-product-number-pad-x);
    border: none;
}

/* ==========================================
   PADDING SYSTEM
   ========================================== */
.ws-box-pad {
    padding: var(--ws-col-pad);
    box-sizing: border-box;
}

.ws-content-wrapper {
    padding: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.ws-below-single {
    padding-top: var(--ws-layout-section-pad-top);
}

/* ==========================================
   TABLES – mobile containment
   Wrapper stays inside parent padding;
   wide tables scroll horizontally inside.
   ========================================== */
.ws-universal-layout .ws-html-field,
.ws-universal-layout .ws-table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.ws-universal-layout .ws-html-field table,
.ws-universal-layout .ws-table-responsive table,
.ws-universal-layout table.ws-table,
.ws-universal-layout table.ws-table-structured {
    width: 100%;
    max-width: none; /* allow intrinsic width for scroll */
    box-sizing: border-box;
}

.ws-universal-layout .ws-html-field table {
    margin: var(--ws-layout-divider-margin-y) 0;
}

/* ==========================================
   DISABLE HORIZONTAL PADDING (Phase 17/5/1)
   ========================================== */
/* Applied when "Remove side padding" is checked in Step 2 for single-box / split-box */
.ws-no-horizontal-padding {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Ensure inner columns also lose horizontal padding
   (split-box + single-box + image-split right column) */
.ws-no-horizontal-padding .ws-col-pad,
.ws-no-horizontal-padding .ws-content-wrapper {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* ==========================================
   BORDER STYLES – DUAL SYSTEM (Phase 1)
   ==========================================
   1. Outer box (registry-driven)
      Classes: .ws-border-1 | .ws-border-2 | .ws-border-transparent
      Emitted by Twig as border_style_class.
      Rules live in design-system.css (and any future token overrides).

   2. Inner T-shape dividers (structural)
      Classes: .border-style-1 | .border-style-2
      Emitted by Twig only when border_style ≠ "none".
      Required for the pros/cons below-split visual.
      Colour via design-system token --color-border-gray.
   ========================================== */

/* Top border on pros/cons columns in below-split */
.ws-below-split .ws-split-col.border-style-1,
.ws-below-split .ws-col-pad.border-style-1 {
    border-top: 1px solid var(--color-border-gray) !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    box-sizing: border-box;
}

.ws-below-split .ws-split-col.border-style-2,
.ws-below-split .ws-col-pad.border-style-2 {
    border-top: 1px solid var(--color-border-gray) !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    box-sizing: border-box;
}

/* Vertical divider between PROS and CONS columns (first child) */
.ws-below-split .ws-split-col.border-style-1:first-child,
.ws-below-split .ws-col-pad.border-style-1:first-child {
    border-right: 1px solid var(--color-border-gray) !important;
}

.ws-below-split .ws-split-col.border-style-2:first-child,
.ws-below-split .ws-col-pad.border-style-2:first-child {
    border-right: 1px solid var(--color-border-gray) !important;
}

/* Minimal fallback for other containers using border-style classes
   (kept for compatibility with current Twig output) */
.border-style-1,
.ws-split-col.border-style-1,
.ws-col-pad.border-style-1 {
    border: 1px solid var(--color-border-gray) !important;
    box-sizing: border-box;
}

.border-style-2,
.ws-split-col.border-style-2,
.ws-col-pad.border-style-2 {
    border: 1px solid var(--color-border-gray) !important;
    box-sizing: border-box;
}

