/* Common styles for all flow demos */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    padding: 40px 20px;
    background: #3b4253;
    color: #eceff4;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
}

h1 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    color: #eceff4;
}

/* Layout container for sidebar layout */
.layout-container {
    display: flex;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    align-items: flex-start;
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* Controls */
.controls {
    width: 320px;

    position: sticky;
    top: 20px;
}

.control-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #4c566a;
}

.control-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.control-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #eccc87;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Button colours */
.add-block {
    background: #a2bf8a;
    color: #2e3440;
}

.add-inline {
    background: #80a0c2;
    color: #eceff4;
}

.add-inline-block {
    background: #a2bf8a;
    color: #2e3440;
}

.add-parent {
    background: #80a0c2;
    color: #eceff4;
}

.add-child {
    background: #a2bf8a;
    color: #2e3440;
}

.add-content {
    background: #eccc87;
    color: #2e3440;
}

.add-fixed {
    background: #c16069;
    color: #eceff4;
}

.add-percent {
    background: #80a0c2;
    color: #eceff4;
}

.add-max {
    background: #a2bf8a;
    color: #2e3440;
}

.add-auto {
    background: #eccc87;
    color: #2e3440;
}

.clear-btn {
    background: #4c566a;
    color: #eceff4;
}

/* Demo container */
.demo-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
}

.demo-container {
    background: #434c5e;
    padding: 20px;
    border-radius: 8px;
    position: relative;
    width: 800px;
}

.container-label {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #4c566a;
    color: #eceff4;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Resize handles */
.resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    background: transparent;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}



.resize-handle::before {
    content: '⋮';
    font-size: 24px;
    color: #eceff4;
    font-weight: bold;
    letter-spacing: -4px;
}

.resize-handle-left {
    left: -30px;
    border-radius: 8px 0 0 8px;
}

.resize-handle-right {
    right: -30px;
    border-radius: 0 8px 8px 0;
}

/* Flow container */
#flowContainer {
    border: 3px dashed #4c566a;
    padding: 15px;
    min-height: 300px;
    overflow: auto;
    background: #3b4253;
}

.demo-wrapper {
    margin-bottom: 0;
}

/* Dimension display */
.dimension-display {
    position: absolute;
    top: -35px;
    right: 0;
    background: #4c566a;
    color: #eceff4;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Elements */
.block-element {
    background: #a2bf8a;
    color: #2e3440;
    padding: 15px;
    margin: 8px 0;
    border-radius: 4px;
    font-weight: 600;
    display: block;
}

.inline-element {
    background: #80a0c2;
    color: #eceff4;
    padding: 8px 12px;
    margin: 0 4px;
    border-radius: 4px;
    font-weight: 600;
    display: inline;
}

.inline-block-element {
    background: #80a0c2;
    color: #eceff4;
    padding: 12px 16px;
    margin: 6px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
}

.element-label {
    font-size: 14px;
}

/* Demo 2: Nested containers */
.parent-container {
    border: 3px solid #80a0c2;
    padding: 15px;
    margin: 10px 0;
    background: rgba(128, 160, 194, 0.1);
    position: relative;
    min-height: 60px;
}

.parent-label {
    position: absolute;
    top: -12px;
    left: 10px;
    background: #80a0c2;
    color: #2e3440;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.child-container {
    border: 3px solid #a2bf8a;
    padding: 12px;
    margin: 8px 0;
    background: rgba(162, 191, 138, 0.1);
    position: relative;
    min-height: 40px;
}

.child-label {
    position: absolute;
    top: -12px;
    left: 10px;
    background: #a2bf8a;
    color: #2e3440;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.content-element {
    background: #eccc87;
    color: #2e3440;
    padding: 10px;
    margin: 5px 0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.selected {
    outline: 3px solid #eceff4;
    outline-offset: 2px;
}

.selection-hint {
    font-size: 14px;
    color: #eccc87;
    margin-top: 10px;
    text-align: center;
    font-style: italic;
}

/* Demo 3: Width boxes */
.box {
    padding: 15px;
    margin: 10px 0;
    border-radius: 4px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.box-label {
    font-size: 14px;
}

.box-size {
    font-size: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 3px;
}

.fixed-box {
    background: #c16069;
    color: #eceff4;
    width: 300px;
}

.percent-box {
    background: #80a0c2;
    color: #eceff4;
    width: 50%;
}

.max-width-box {
    background: #a2bf8a;
    color: #2e3440;
    width: 100%;
    max-width: 400px;
}

.auto-box {
    background: #eccc87;
    color: #2e3440;
    width: auto;
}

/* Demo 4: Margin and padding */
.visual-demo {
    position: relative;
    padding: 40px;
    background: #2e3440;
    border: 2px dashed #4c566a;
    border-radius: 8px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.box-wrapper {
    position: relative;
    display: inline-block;
}

.margin-visualizer {
    background: rgba(210, 135, 109, 0.4);
    display: inline-block;
    position: relative;
}

.border-visualizer {
    background: #80a0c2;
    border: 3px solid #80a0c2;
    display: inline-block;
    position: relative;
}

.padding-visualizer {
    background: rgba(162, 191, 138, 0.4);
    border: 2px solid #a2bf8a;
    display: inline-block;
    position: relative;
}

.content-visualizer {
    background: #eceff4;
    color: #2e3440;
    padding: 20px 40px;
    font-weight: 600;
    text-align: center;
    display: inline-block;
}

.label {
    position: absolute;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    white-space: nowrap;
}

.margin-label {
    background: #d2876d;
    color: #2e3440;
}

.padding-label {
    background: #a2bf8a;
    color: #2e3440;
}

/* Legend */
.legend {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    font-size: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

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

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.margin-color {
    background: rgba(210, 135, 109, 0.4);
    border: 2px solid #d2876d;
}

.border-color {
    background: #80a0c2;
}

.padding-color {
    background: rgba(162, 191, 138, 0.4);
    border: 2px solid #a2bf8a;
}

.content-color {
    background: #eceff4;
}

/* Sliders (Demo 4) */
.slider-group {
    margin-bottom: 20px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #eceff4;
}

.slider-value {
    color: #eccc87;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #4c566a;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #80a0c2;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #80a0c2;
    cursor: pointer;
    border: none;
}