/**
 * FG Flex & Grid Utilities
 * A lightweight CSS utility library for Flexbox and Grid layouts
 * Prefix: fg- (flex-grid)
 * Version: 1.0
 */

/* ===== FLEXBOX UTILITIES ===== */
.fg-flex { display: flex; }
.fg-inline-flex { display: inline-flex; }

/* Flex Direction */
.fg-flex-row { flex-direction: row; }
.fg-flex-row-reverse { flex-direction: row-reverse; }
.fg-flex-col { flex-direction: column; }
.fg-flex-col-reverse { flex-direction: column-reverse; }

/* Flex Wrapping */
.fg-flex-wrap { flex-wrap: wrap; }
.fg-flex-nowrap { flex-wrap: nowrap; }
.fg-flex-wrap-reverse { flex-wrap: wrap-reverse; }

.fg-flex-1 { flex: 1; }

/* Flex shorthand utilities */
.fg-flex-initial { flex: 0 1 auto; } /* Default */
.fg-flex-1 { flex: 1 1 0%; }          /* Grow/shrink equally, basis 0 */
.fg-flex-auto { flex: 1 1 auto; }     /* Grow/shrink, content-based width */
.fg-flex-none { flex: none; }         /* No flexing */

/* Justify Content */
.fg-flex-justify-start { justify-content: flex-start; }
.fg-flex-justify-center { justify-content: center; }
.fg-flex-justify-end { justify-content: flex-end; }
.fg-flex-justify-between { justify-content: space-between; }
.fg-flex-justify-around { justify-content: space-around; }
.fg-flex-justify-evenly { justify-content: space-evenly; }

/* Align Items */
.fg-flex-align-start { align-items: flex-start; }
.fg-flex-align-center { align-items: center; }
.fg-flex-align-end { align-items: flex-end; }
.fg-flex-align-stretch { align-items: stretch; }
.fg-flex-align-baseline { align-items: baseline; }

/* Align Self */
.fg-flex-self-start { align-self: flex-start; }
.fg-flex-self-center { align-self: center; }
.fg-flex-self-end { align-self: flex-end; }
.fg-flex-self-stretch { align-self: stretch; }
.fg-flex-self-auto { align-self: auto; }

/* Flex Grow/Shrink */
.fg-flex-grow-0 { flex-grow: 0; }
.fg-flex-grow { flex-grow: 1; }
.fg-flex-grow-2 { flex-grow: 2; }
.fg-flex-shrink-0 { flex-shrink: 0; }
.fg-flex-shrink { flex-shrink: 1; }

/* Order */
.fg-flex-order-first { order: -1; }
.fg-flex-order-1 { order: 1; }
.fg-flex-order-2 { order: 2; }
.fg-flex-order-3 { order: 3; }
.fg-flex-order-last { order: 999; }

/* Gap Utilities */
.fg-flex-gap-0 { gap: 0; }
.fg-flex-gap-1 { gap: 0.25rem; }
.fg-flex-gap-2 { gap: 0.5rem; }
.fg-flex-gap-3 { gap: 1rem; }
.fg-flex-gap-4 { gap: 1.5rem; }
.fg-flex-gap-5 { gap: 2rem; }

/* ===== GRID UTILITIES ===== */
.fg-grid { display: grid; }
.fg-inline-grid { display: inline-grid; }

/* Grid Columns */
.fg-grid-cols-none { grid-template-columns: none; }
.fg-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.fg-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fg-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fg-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fg-grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* Grid Rows */
.fg-grid-rows-none { grid-template-rows: none; }
.fg-grid-rows-1 { grid-template-rows: repeat(1, minmax(0, 1fr)); }
.fg-grid-rows-2 { grid-template-rows: repeat(2, minmax(0, 1fr)); }
.fg-grid-rows-3 { grid-template-rows: repeat(3, minmax(0, 1fr)); }
.fg-grid-rows-4 { grid-template-rows: repeat(4, minmax(0, 1fr)); }

/* Grid Auto Flow */
.fg-grid-auto-flow-row { grid-auto-flow: row; }
.fg-grid-auto-flow-col { grid-auto-flow: column; }
.fg-grid-auto-flow-dense { grid-auto-flow: dense; }

/* ===== RESPONSIVE UTILITIES ===== */
@media (min-width: 640px) {
  .sm\:fg-flex { display: flex; }
  .sm\:fg-flex-1 { flex: 1; }
  .sm\:fg-grid { display: grid; }
  .sm\:fg-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .md\:fg-flex { display: flex; }
  .md\:fg-flex-1 { flex: 1; }
  .md\:fg-grid { display: grid; }
  .md\:fg-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:fg-flex { display: flex; }
  .lg\:fg-flex-1 { flex: 1; }
  .lg\:fg-grid { display: grid; }
  .lg\:fg-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .xl\:fg-flex { display: flex; }
  .xl\:fg-flex-1 { flex: 1; }
  .xl\:fg-grid { display: grid; }
  .xl\:fg-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .fg-flex-wrap-mobile { flex-wrap: wrap; }
  .fg-flex-basis-half-mobile {
    flex: 1 1 calc(50% - 0.5rem);
  }
}
