* {
  box-sizing: border-box;
  font-family: system-ui, Arial, sans-serif;
}

body {
  margin: 0;
  background: #f4f6f8;
  display: flex;
  min-height: 100vh;
}

h1, h2 {
  margin: 0 0 0.5rem 0;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.4rem;
  display: inline-block;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  border: 2px solid #c7c7c7;
  border-radius: 6px;
  background: #f9fafb;
  margin-right: 0.4rem;
  margin-bottom: 0.4rem;
  user-select: none;
}

label:hover {
  background: #eef2ff;
  border-color: #4f46e5;
}

/* =====================
SIDEBAR
===================== */

/* Button Styling */
.controls {
  width: 320px;
  padding: 1rem;
  background: #ffffff;
  border-right: 2px solid #ddd;
  overflow-y: auto;
  position: relative;
}

.control-group {
  margin-bottom: 1rem;
}

.note {
  font-size: 0.8rem;
  color: #555;
}

input[type="radio"], input[type="checkbox"] {
  margin-right: 0.4rem;
}

label.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

/* =====================
SANDBOX AREA
===================== */
.sandbox-wrapper {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sandbox {
  min-height: 200px;
  background: #ffffff;
  border: 2px dashed #999;
  padding: 1rem;
  display: flex;
  gap: 0px;
}

/* =====================
FLEX ITEMS
===================== */
.box {
  background: #4f46e5;
  color: white;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 100px;
}

.box:nth-child(2) { background: #16a34a; height: 80px;}
.box:nth-child(3) { background: #dc2626; height: 120px;}
.box:nth-child(4) { background: #ca8a04; height: 100px;}
.box:nth-child(5) { background: #0891b2; height: 80px;}
.box:nth-child(6) { background: #f43f5e; height: 120px;} 
.box:nth-child(7) { background: #f97316; height: 120px;}  
.box:nth-child(8) { background: #eab308; height: 80px;}
.box:nth-child(9) { background: #22c55e; height: 100px;}
.box:nth-child(10){ background: #0ea5e9; height: 120px;}
.box:nth-child(11){ background: #8b5cf6; height: 80px;}
.box:nth-child(12){ background: #f472b6; height: 100px;}


/* =====================
FLEXBOX STATES (CSS ONLY)
===================== */

/* Width */
#width-100:checked ~ .sandbox-wrapper .sandbox {width: 100%;}
#width-75:checked ~ .sandbox-wrapper .sandbox {width: 75%;}
#width-50:checked ~ .sandbox-wrapper .sandbox {width: 50%;}
#width-30:checked ~ .sandbox-wrapper .sandbox {width: 30%;}
#width-100:checked ~ .controls label[for="width-100"],
#width-75:checked ~ .controls label[for="width-75"],
#width-50:checked ~ .controls label[for="width-50"],
#width-30:checked ~ .controls label[for="width-30"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

/* Height */
#height-auto:checked ~ .sandbox-wrapper .sandbox {height: auto;}
#height-200:checked ~ .sandbox-wrapper .sandbox { height: 200px; }
#height-400:checked ~ .sandbox-wrapper .sandbox { height: 400px; }
#height-600:checked ~ .sandbox-wrapper .sandbox { height: 600px; }

#height-auto:checked ~ .controls label[for="height-auto"],
#height-200:checked ~ .controls label[for="height-200"],
#height-400:checked ~ .controls label[for="height-400"],
#height-600:checked ~ .controls label[for="height-600"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

/* Display */
#display-flex:checked ~ .sandbox-wrapper .sandbox {
  display: flex;
}
#display-flex:checked ~ .controls label[for="display-flex"],
#display-block:checked ~ .controls label[for="display-block"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}
#display-block:checked ~ .sandbox-wrapper .sandbox {
  display: block;
}

/* Flex-Direction */
#dir-row:checked ~ .sandbox-wrapper .sandbox { flex-direction: row; }
#dir-row-reverse:checked ~ .sandbox-wrapper .sandbox {
  flex-direction: row-reverse;
}
#dir-column:checked ~ .sandbox-wrapper .sandbox { flex-direction: column; }
#dir-column-reverse:checked ~ .sandbox-wrapper .sandbox {
  flex-direction: column-reverse;
}
#dir-row-reverse:checked ~ .controls label[for="dir-row-reverse"],
#dir-column-reverse:checked ~ .controls label[for="dir-column-reverse"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}
#dir-row:checked ~ .controls label[for="dir-row"],
#dir-column:checked ~ .controls label[for="dir-column"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

/* Flex-Wrap */
#wrap-on:checked ~ .sandbox-wrapper .sandbox { flex-wrap: wrap; }
#wrap-off:checked ~ .sandbox-wrapper .sandbox { flex-wrap: nowrap; }
#wrap-on:checked ~ .controls label[for="wrap-on"],
#wrap-off:checked ~ .controls label[for="wrap-off"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}
#wrap-off:checked ~ .controls label[for^="ac-"] {
  opacity: 0.4;
  pointer-events: none;
}

/* Justify Content */
#just-start:checked ~ .sandbox-wrapper .sandbox { justify-content: flex-start; }
#just-center:checked ~ .sandbox-wrapper .sandbox { justify-content: center; }
#just-end:checked ~ .sandbox-wrapper .sandbox { justify-content: flex-end; }
#just-between:checked ~ .sandbox-wrapper .sandbox { justify-content: space-between; }
#just-start:checked ~ .controls label[for="just-start"],
#just-center:checked ~ .controls label[for="just-center"],
#just-end:checked ~ .controls label[for="just-end"],
#just-between:checked ~ .controls label[for="just-between"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}
#just-around:checked ~ .sandbox-wrapper .sandbox {
  justify-content: space-around;
}
#just-evenly:checked ~ .sandbox-wrapper .sandbox {
  justify-content: space-evenly;
}
#just-between:checked ~ .controls label[for="just-between"],
#just-around:checked ~ .controls label[for="just-around"],
#just-evenly:checked ~ .controls label[for="just-evenly"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

/* Align Items */
#align-start:checked ~ .sandbox-wrapper .sandbox { align-items: flex-start; }
#align-center:checked ~ .sandbox-wrapper .sandbox { align-items: center; }
#align-end:checked ~ .sandbox-wrapper .sandbox { align-items: flex-end; }

#align-start:checked ~ .controls label[for="align-start"],
#align-center:checked ~ .controls label[for="align-center"],
#align-end:checked ~ .controls label[for="align-end"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

/* Align Content */
#ac-start:checked ~ .sandbox-wrapper .sandbox {
  align-content: flex-start;
}
#ac-center:checked ~ .sandbox-wrapper .sandbox {
  align-content: center;
}
#ac-end:checked ~ .sandbox-wrapper .sandbox {
  align-content: flex-end;
}
#ac-between:checked ~ .sandbox-wrapper .sandbox {
  align-content: space-between;
}
#ac-around:checked ~ .sandbox-wrapper .sandbox {
  align-content: space-around;
}
#ac-start:checked ~ .controls label[for="ac-start"],
#ac-center:checked ~ .controls label[for="ac-center"],
#ac-end:checked ~ .controls label[for="ac-end"],
#ac-between:checked ~ .controls label[for="ac-between"],
#ac-around:checked ~ .controls label[for="ac-around"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

/* Gap */
#gap-small:checked ~ .sandbox-wrapper .sandbox { 
  gap: 10px; }
#gap-large:checked ~ .sandbox-wrapper .sandbox { 
  gap: 30px; }
#gap-none:checked ~ .sandbox-wrapper .sandbox {
  gap: 0;
}
#gap-none:checked ~ .controls label[for="gap-none"],
#gap-small:checked ~ .controls label[for="gap-small"],
#gap-large:checked ~ .controls label[for="gap-large"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

/* =====================
HELP BOX
===================== */
.help {
  font-size: 0.85rem;
  background: #eef2ff;
  padding: 0.75rem;
  border-left: 4px solid #4f46e5;
}

/* Tooltip message when Flexbox is OFF */
#display-block:checked ~ aside.controls::after {
  content: "Flexbox is OFF. These controls only work when display:flex is turned on.";
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  background: #1f2937;
  color: white;
  font-size: 0.8rem;
  padding: 0.6rem;
  border-radius: 6px;
  line-height: 1.3;
}

/* When Flexbox is OFF, disable all controls */
#display-block:checked ~ .controls .control-group {
  opacity: 0.35;
  pointer-events: none;
}

/* EXCEPT the display toggle itself */
#display-block:checked ~ .controls .display-toggle {
  opacity: 1;
  pointer-events: auto;
}

/* Target only the Align-Content control group */
.controls .control-group.align-content-tooltip::after {
  content: "Align-content only affects multi-line layouts.";
  display: block;
  font-size: 0.75rem;
  color: #dc2626;
  margin-top: 0.3rem;
  opacity: 0;              /* hidden by default */
  transition: opacity 0.3s;
}

/* Show tooltip only when wrapping is off */
#wrap-off:checked ~ .controls .control-group.align-content-tooltip::after {
  opacity: 1;
}

/* Optional: make it look more like a tooltip */
#wrap-off:checked ~ .controls .control-group.align-content-tooltip::after {
  background: #1f2937;
  color: #fff;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  margin-top: 0.5rem;
}


