/**
 * PennyBot Utilities CSS v1.0.0
 *
 * Helper/utility classes for rapid styling.
 * Depends on design-tokens.css for variables.
 *
 * Contents:
 * 1. Spacing (Margin & Padding)
 * 2. Typography
 * 3. Display & Visibility
 * 4. Position
 * 5. Width & Height
 * 6. Border & Radius
 * 7. Background & Colors
 * 8. Shadows
 * 9. Cursor & Pointer
 * 10. Overflow
 * 11. Accessibility
 * 12. Progress Bars & Gradients
 */

/* ============================================
   1. SPACING (Margin & Padding)
   ============================================ */

/* Margin - all sides */
.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-5 { margin: var(--space-5); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }
.m-auto { margin: auto; }

/* Margin - horizontal */
.mx-auto { margin-left: auto; margin-right: auto; }
.mx-2 { margin-left: var(--space-2); margin-right: var(--space-2); }
.mx-4 { margin-left: var(--space-4); margin-right: var(--space-4); }

/* Margin - vertical */
.my-2 { margin-top: var(--space-2); margin-bottom: var(--space-2); }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.my-6 { margin-top: var(--space-6); margin-bottom: var(--space-6); }

/* Margin - top */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

/* Margin - bottom */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Margin - left */
.ml-1 { margin-left: var(--space-1); }
.ml-2 { margin-left: var(--space-2); }
.ml-3 { margin-left: var(--space-3); }
.ml-4 { margin-left: var(--space-4); }
.ml-6 { margin-left: var(--space-6); }

/* Margin - right */
.mr-1 { margin-right: var(--space-1); }
.mr-2 { margin-right: var(--space-2); }
.mr-3 { margin-right: var(--space-3); }
.mr-4 { margin-right: var(--space-4); }
.mr-6 { margin-right: var(--space-6); }

/* Padding - all sides */
.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* Padding - horizontal */
.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-5 { padding-left: var(--space-5); padding-right: var(--space-5); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

/* Padding - vertical */
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-5 { padding-top: var(--space-5); padding-bottom: var(--space-5); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }

/* Padding - top */
.pt-2 { padding-top: var(--space-2); }
.pt-3 { padding-top: var(--space-3); }
.pt-4 { padding-top: var(--space-4); }
.pt-5 { padding-top: var(--space-5); }
.pt-6 { padding-top: var(--space-6); }

/* Padding - bottom */
.pb-2 { padding-bottom: var(--space-2); }
.pb-3 { padding-bottom: var(--space-3); }
.pb-4 { padding-bottom: var(--space-4); }
.pb-5 { padding-bottom: var(--space-5); }
.pb-6 { padding-bottom: var(--space-6); }

/* ============================================
   2. TYPOGRAPHY
   ============================================ */

/* Font Sizes */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-md { font-size: var(--font-size-md); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }

/* Font Weights */
.fw-normal { font-weight: var(--font-weight-regular); }
.fw-medium { font-weight: var(--font-weight-medium); }
.fw-semibold { font-weight: var(--font-weight-semibold); }
.fw-bold { font-weight: var(--font-weight-bold); }

/* Alternative weight syntax */
.font-regular { font-weight: var(--font-weight-regular); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Text Colors */
.text-default { color: var(--color-text-default); }
.text-muted { color: var(--color-text-muted); }
.text-inverse { color: var(--color-text-inverse); }
.text-primary { color: var(--color-brand-primary); }
.text-secondary { color: var(--color-brand-secondary); }
.text-positive { color: var(--color-positive); }
.text-negative { color: var(--color-negative); }
.text-warning { color: var(--color-warning); }

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

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

/* Letter Spacing */
.tracking-wide { letter-spacing: 0.05em; }
.tracking-wider { letter-spacing: 0.1em; }
.tracking-widest { letter-spacing: 0.15em; }

/* Line Height */
.leading-tight { line-height: var(--line-height-tight); }
.leading-normal { line-height: var(--line-height-normal); }
.leading-loose { line-height: var(--line-height-loose); }

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

/* Font Family */
.font-mono { font-family: monospace; }
.font-primary { font-family: var(--font-primary); }
.font-accent { font-family: var(--font-accent); }

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

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   3. DISPLAY & VISIBILITY
   ============================================ */

.hidden { display: none !important; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

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

/* Visibility */
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* ============================================
   4. POSITION
   ============================================ */

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

/* Position values */
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

/* Z-index */
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }
.z-1000 { z-index: 1000; }

/* ============================================
   5. WIDTH & HEIGHT
   ============================================ */

.w-full { width: 100%; }
.w-auto { width: auto; }
.w-100 { width: 100%; }

.max-w-sm { max-width: 400px; }
.max-w-md { max-width: 500px; }
.max-w-lg { max-width: 600px; }
.max-w-xl { max-width: 800px; }
.max-w-full { max-width: 100%; }

.min-w-0 { min-width: 0; }

.h-full { height: 100%; }
.h-auto { height: auto; }
.h-100 { height: 100%; }

.min-h-screen { min-height: 100vh; }

/* ============================================
   6. BORDER & RADIUS
   ============================================ */

.border { border: 1px solid var(--color-border-default); }
.border-0 { border: none; }
.border-strong { border: 1px solid var(--color-border-strong); }

.border-t { border-top: 1px solid var(--color-border-default); }
.border-r { border-right: 1px solid var(--color-border-default); }
.border-b { border-bottom: 1px solid var(--color-border-default); }
.border-l { border-left: 1px solid var(--color-border-default); }

.border-top { border-top: 1px solid var(--color-border-default); }
.border-bottom { border-bottom: 1px solid var(--color-border-default); }
.border-b-2 { border-bottom: 2px solid var(--color-border-default); }

/* Border Radius */
.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded { border-radius: var(--radius-md); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
.rounded-pill { border-radius: var(--radius-pill); }

/* Alternative syntax */
.radius-sm { border-radius: var(--radius-sm); }
.radius-md { border-radius: var(--radius-md); }
.radius-lg { border-radius: var(--radius-lg); }
.radius-pill { border-radius: var(--radius-pill); }

/* ============================================
   7. BACKGROUND & COLORS
   ============================================ */

.bg-base { background-color: var(--color-bg-base); }
.bg-subtle { background-color: var(--color-bg-subtle); }
.bg-muted { background-color: var(--color-bg-muted); }
.bg-elevated { background-color: var(--color-bg-elevated); }

.bg-primary { background-color: var(--color-brand-primary); }
.bg-secondary { background-color: var(--color-brand-secondary); }
.bg-accent { background-color: var(--color-brand-accent); }
.bg-highlight { background-color: var(--color-brand-highlight); }

.bg-transparent { background-color: transparent; }
.bg-white { background-color: var(--color-bg-base); }

/* Brand Gradient Backgrounds */
.bg-gradient-primary {
  background: linear-gradient(135deg, var(--color-brand-primary) 0%, var(--color-brand-secondary) 100%);
}

.bg-gradient-accent {
  background: linear-gradient(135deg, var(--color-brand-accent) 0%, #059669 100%);
}

.bg-gradient-highlight {
  background: linear-gradient(135deg, var(--color-brand-highlight) 0%, #f59e0b 100%);
}

/* ============================================
   8. SHADOWS
   ============================================ */

.shadow-none { box-shadow: none; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* ============================================
   9. CURSOR & POINTER
   ============================================ */

.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }
.cursor-help { cursor: help; }
.cursor-wait { cursor: wait; }
.cursor-move { cursor: move; }
.cursor-grab { cursor: grab; }

.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

.select-none { user-select: none; }
.select-text { user-select: text; }
.select-all { user-select: all; }

/* ============================================
   10. OVERFLOW
   ============================================ */

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

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

/* ============================================
   11. ACCESSIBILITY
   ============================================ */

/* Focus Indicators */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--color-brand-primary);
  outline-offset: 2px;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-brand-neutral-dark);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  top: 0;
}

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

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   12. PROGRESS BARS & GRADIENTS
   ============================================ */

.progress-green { background: linear-gradient(90deg, var(--color-positive) 0%, #059669 100%); }
.progress-yellow { background: linear-gradient(90deg, var(--color-warning) 0%, #d97706 100%); }
.progress-orange { background: linear-gradient(90deg, #f97316 0%, #ea580c 100%); }
.progress-red { background: linear-gradient(90deg, var(--color-negative) 0%, var(--color-negative-strong) 100%); }

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

.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }
.opacity-75 { opacity: 0.75; }
.opacity-80 { opacity: 0.8; }
.opacity-90 { opacity: 0.9; }
.opacity-100 { opacity: 1; }

/* ============================================
   COMPONENT-SPECIFIC UTILITIES
   ============================================ */

/* Address autocomplete dropdown highlight */
.address-autocomplete-item--highlighted {
  background: var(--color-info-bg);
}

/* Upload modal type-option hover */
.type-option:hover {
  border-color: var(--color-info) !important;
  background: var(--color-bg-subtle) !important;
}
