/**
 * UTILITIES CSS
 *
 * Reusable utility classes following atomic CSS principles
 * Inspired by Tailwind CSS but optimized for our design system
 *
 * Categories:
 * - Spacing (margin, padding)
 * - Display & Layout (flexbox, grid)
 * - Typography (text alignment, weight, size)
 * - Colors (background, text, border)
 * - Borders & Radius
 * - Shadows
 * - Miscellaneous
 *
 * Version: 1.0.0
 * Last Updated: 2025-11-01
 */

/* =============================================================================
   SPACING UTILITIES
   Based on 4px scale: 4, 8, 12, 16, 20, 24, 32, 40, 48, 64
   ============================================================================= */

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }      /* 4px */
.p-2 { padding: 0.5rem; }       /* 8px */
.p-3 { padding: 0.75rem; }      /* 12px */
.p-4 { padding: 1rem; }         /* 16px */
.p-5 { padding: 1.25rem; }      /* 20px */
.p-6 { padding: 1.5rem; }       /* 24px */
.p-8 { padding: 2rem; }         /* 32px */
.p-10 { padding: 2.5rem; }      /* 40px */
.p-12 { padding: 3rem; }        /* 48px */
.p-16 { padding: 4rem; }        /* 64px */

/* Padding X (horizontal) */
.px-0 { padding-left: 0; padding-right: 0; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }

/* Padding Y (vertical) */
.py-0 { padding-top: 0; padding-bottom: 0; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

/* Padding Top */
.pt-0 { padding-top: 0; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }

/* Padding Bottom */
.pb-0 { padding-bottom: 0; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.pb-6 { padding-bottom: 1.5rem; }
.pb-8 { padding-bottom: 2rem; }

/* Margin */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-6 { margin: 1.5rem; }
.m-8 { margin: 2rem; }
.m-auto { margin: auto; }

/* Margin X (horizontal) */
.mx-auto { margin-left: auto; margin-right: auto; }
.mx-2 { margin-left: 0.5rem; margin-right: 0.5rem; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; }

/* Margin Y (vertical) */
.my-0 { margin-top: 0; margin-bottom: 0; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }

/* Margin Top */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

/* Margin Bottom */
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

/* Gap (for flexbox/grid) */
.gap-0 { gap: 0; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* =============================================================================
   DISPLAY & LAYOUT
   ============================================================================= */

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-grid { display: grid; }

/* Flexbox Direction */
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.flex-row-reverse { flex-direction: row-reverse; }
.flex-column-reverse { flex-direction: column-reverse; }

/* Flexbox Wrap */
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

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

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

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

/* Flex Grow & Shrink */
.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-initial { flex: 0 1 auto; }
.flex-none { flex: none; }
.flex-grow-0 { flex-grow: 0; }
.flex-grow-1 { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-shrink-1 { flex-shrink: 1; }

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

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* Font Weight */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* Font Size */
.text-xs { font-size: 0.75rem; }      /* 12px */
.text-sm { font-size: 0.875rem; }     /* 14px */
.text-base { font-size: 1rem; }       /* 16px */
.text-lg { font-size: 1.125rem; }     /* 18px */
.text-xl { font-size: 1.25rem; }      /* 20px */
.text-2xl { font-size: 1.5rem; }      /* 24px */
.text-3xl { font-size: 1.875rem; }    /* 30px */
.text-4xl { font-size: 2.25rem; }     /* 36px */

/* Line Height */
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-normal { line-height: 1.5; }
.leading-relaxed { line-height: 1.625; }
.leading-loose { line-height: 2; }

/* Text Transform */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.normal-case { text-transform: none; }

/* Text Decoration */
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.no-underline { text-decoration: none; }

/* White Space */
.whitespace-normal { white-space: normal; }
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre { white-space: pre; }

/* Text Overflow */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =============================================================================
   COLORS
   Using CSS variables for theme support
   ============================================================================= */

/* Text Colors */
.text-primary { color: var(--color-text-primary, #111827); }
.text-secondary { color: var(--color-text-secondary, #6b7280); }
.text-tertiary { color: var(--color-text-tertiary, #9ca3af); }
.text-accent { color: var(--color-accent, #d4af37); }
.text-error { color: var(--color-error, #ef4444); }
.text-success { color: var(--color-success, #10b981); }
.text-warning { color: var(--color-warning, #f59e0b); }
.text-info { color: var(--color-info, #3b82f6); }
.text-white { color: #ffffff; }
.text-black { color: #000000; }

/* Background Colors */
.bg-primary { background-color: var(--color-primary, #0c2340); }
.bg-accent { background-color: var(--color-accent, #d4af37); }
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: var(--color-gray-50, #f9fafb); }
.bg-gray-100 { background-color: var(--color-gray-100, #f3f4f6); }
.bg-gray-200 { background-color: var(--color-gray-200, #e5e7eb); }
.bg-error { background-color: var(--color-error, #ef4444); }
.bg-success { background-color: var(--color-success, #10b981); }
.bg-warning { background-color: var(--color-warning, #f59e0b); }
.bg-transparent { background-color: transparent; }

/* Border Colors */
.border-gray-200 { border-color: var(--color-border, #e5e7eb); }
.border-gray-300 { border-color: #d1d5db; }
.border-accent { border-color: var(--color-accent, #d4af37); }
.border-error { border-color: var(--color-error, #ef4444); }
.border-success { border-color: var(--color-success, #10b981); }
.border-transparent { border-color: transparent; }

/* =============================================================================
   BORDERS & RADIUS
   ============================================================================= */

/* Border Width */
.border-0 { border-width: 0; }
.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-4 { border-width: 4px; }

/* Border Style */
.border-solid { border-style: solid; }
.border-dashed { border-style: dashed; }
.border-dotted { border-style: dotted; }
.border-none { border-style: none; }

/* Border Radius */
.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: 0.25rem; }   /* 4px */
.rounded { border-radius: 0.5rem; }       /* 8px */
.rounded-md { border-radius: 0.5rem; }    /* 8px */
.rounded-lg { border-radius: 0.75rem; }   /* 12px */
.rounded-xl { border-radius: 1rem; }      /* 16px */
.rounded-2xl { border-radius: 1.5rem; }   /* 24px */
.rounded-full { border-radius: 9999px; }

/* =============================================================================
   SHADOWS
   ============================================================================= */

.shadow-none { box-shadow: none; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }

/* =============================================================================
   WIDTH & HEIGHT
   ============================================================================= */

/* Width */
.w-auto { width: auto; }
.w-full { width: 100%; }
.w-screen { width: 100vw; }
.w-1\/2 { width: 50%; }
.w-1\/3 { width: 33.333333%; }
.w-2\/3 { width: 66.666667%; }
.w-1\/4 { width: 25%; }
.w-3\/4 { width: 75%; }

/* Max Width */
.max-w-xs { max-width: 20rem; }      /* 320px */
.max-w-sm { max-width: 24rem; }      /* 384px */
.max-w-md { max-width: 28rem; }      /* 448px */
.max-w-lg { max-width: 32rem; }      /* 512px */
.max-w-xl { max-width: 36rem; }      /* 576px */
.max-w-2xl { max-width: 42rem; }     /* 672px */
.max-w-3xl { max-width: 48rem; }     /* 768px */
.max-w-4xl { max-width: 56rem; }     /* 896px */
.max-w-5xl { max-width: 64rem; }     /* 1024px */
.max-w-6xl { max-width: 72rem; }     /* 1152px */
.max-w-7xl { max-width: 80rem; }     /* 1280px */
.max-w-full { max-width: 100%; }
.max-w-screen { max-width: 100vw; }

/* Height */
.h-auto { height: auto; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }

/* =============================================================================
   POSITION
   ============================================================================= */

.static { position: static; }
.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.sticky { position: sticky; }

/* Top/Right/Bottom/Left */
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

/* =============================================================================
   OVERFLOW
   ============================================================================= */

.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-visible { overflow: visible; }
.overflow-scroll { overflow: scroll; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-hidden { overflow-x: hidden; }
.overflow-y-hidden { overflow-y: hidden; }

/* =============================================================================
   CURSOR
   ============================================================================= */

.cursor-auto { cursor: auto; }
.cursor-default { cursor: default; }
.cursor-pointer { cursor: pointer; }
.cursor-wait { cursor: wait; }
.cursor-text { cursor: text; }
.cursor-move { cursor: move; }
.cursor-not-allowed { cursor: not-allowed; }

/* =============================================================================
   OPACITY
   ============================================================================= */

.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* =============================================================================
   TRANSITIONS
   ============================================================================= */

.transition-none { transition-property: none; }
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition { transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-colors { transition-property: background-color, border-color, color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-opacity { transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-transform { transition-property: transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }

.duration-75 { transition-duration: 75ms; }
.duration-100 { transition-duration: 100ms; }
.duration-150 { transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.duration-500 { transition-duration: 500ms; }

.ease-linear { transition-timing-function: linear; }
.ease-in { transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }

/* =============================================================================
   MISCELLANEOUS
   ============================================================================= */

/* Pointer Events */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* User Select */
.select-none { user-select: none; }
.select-text { user-select: text; }
.select-all { user-select: all; }
.select-auto { user-select: auto; }

/* Object Fit */
.object-contain { object-fit: contain; }
.object-cover { object-fit: cover; }
.object-fill { object-fit: fill; }
.object-none { object-fit: none; }
.object-scale-down { object-fit: scale-down; }

/* Object Position */
.object-center { object-position: center; }
.object-top { object-position: top; }
.object-bottom { object-position: bottom; }
.object-left { object-position: left; }
.object-right { object-position: right; }

/* Screen Reader Only (Accessibility) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.not-sr-only {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* =============================================================================
   RESPONSIVE UTILITIES
   Apply utilities at specific breakpoints
   ============================================================================= */

/* Tablet (768px and up) */
@media (min-width: 768px) {
    .md\:d-flex { display: flex; }
    .md\:d-block { display: block; }
    .md\:d-none { display: none; }
    .md\:flex-row { flex-direction: row; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:text-left { text-align: left; }
    .md\:w-1\/2 { width: 50%; }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
    .lg\:d-flex { display: flex; }
    .lg\:d-block { display: block; }
    .lg\:d-none { display: none; }
    .lg\:flex-row { flex-direction: row; }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:w-1\/3 { width: 33.333333%; }
    .lg\:w-1\/4 { width: 25%; }
}

/* Large Desktop (1440px and up) */
@media (min-width: 1440px) {
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
