/* ===================================================================
   Utility Classes
   Sequoia and Kings Canyon National Parks - Ranger Resources
   Helper classes for layout, alignment, and common patterns
   =================================================================== */

/* ===================================================================
   LAYOUT UTILITIES
   =================================================================== */

/* Clearfix utility */
.u-clearfix,
.clear {
  clear: both;
}

.u-clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* Float utilities */
.u-float-left,
.leftalign {
  float: left;
}

.u-float-right,
.rightalign {
  float: right;
}

.u-center-block,
.centeralign {
  margin: var(--spacing-sm) auto var(--spacing-sm) auto;
}

/* Image float utilities with border */
img.u-float-left,
img.leftalign,
img.u-float-right,
img.rightalign,
img.u-center-block,
img.centeralign {
  display: block;
  padding: var(--spacing-sm);
  background: var(--color-bg-white);
  border: solid 1px var(--color-border-light);
  margin: var(--spacing-sm);
}

/* ===================================================================
   TEXT UTILITIES
   =================================================================== */

.u-text-center {
  text-align: center;
}

.u-text-left {
  text-align: left;
}

.u-text-right {
  text-align: right;
}

/* ===================================================================
   DISPLAY UTILITIES
   =================================================================== */

.u-hidden {
  display: none;
}

.u-block {
  display: block;
}

.u-inline {
  display: inline;
}

.u-inline-block {
  display: inline-block;
}

.u-flex {
  display: flex;
}

.u-flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ===================================================================
   STATUS BADGE SYSTEM
   Visual indicators for trail/road status
   =================================================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-family: var(--font-family-base);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.status-badge::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Open/Clear - Green Circle */
.status-badge--open {
  background: rgba(107, 142, 35, 0.1);
  color: var(--color-moss-green);
}

.status-badge--open::before {
  background: var(--color-moss-green);
  border-radius: 50%;
}

/* Caution - Yellow Triangle */
.status-badge--caution {
  background: rgba(241, 196, 15, 0.1);
  color: #C29D0B;
}

.status-badge--caution::before {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid var(--color-mustard-yellow);
  border-radius: 0;
  background: transparent;
}

/* Closed/Danger - Red Octagon */
.status-badge--closed {
  background: rgba(192, 57, 43, 0.1);
  color: var(--color-safety-red);
  font-weight: 600;
}

.status-badge--closed::before {
  width: 8px;
  height: 8px;
  background: var(--color-safety-red);
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  border-radius: 0;
}

/* Info Badge */
.status-badge--info {
  background: rgba(41, 128, 185, 0.1);
  color: var(--color-status-blue);
}

.status-badge--info::before {
  background: var(--color-status-blue);
}

/* ===================================================================
   ADDITIONAL UTILITY CLASSES
   Reusable helper classes for common patterns
   =================================================================== */

/* Typography Utilities */
.u-text-mono {
  font-family: var(--font-family-mono);
  font-size: 0.85rem;
}

.u-text-muted {
  color: var(--color-text-muted);
}

.u-text-sm {
  font-size: var(--font-size-sm);
}

.u-text-lg {
  font-size: var(--font-size-lg);
}

/* Spacing Utilities */
.u-mt-0 {
  margin-top: 0;
}

.u-mt-1 {
  margin-top: var(--spacing-1);
}

.u-mt-2 {
  margin-top: var(--spacing-2);
}

.u-mt-4 {
  margin-top: var(--spacing-4);
}

.u-mb-2 {
  margin-bottom: var(--spacing-2);
}

.u-mb-4 {
  margin-bottom: var(--spacing-4);
}

/* Border Utilities */
.u-border-top {
  border-top: 1px solid var(--color-border-light);
}

.u-border-bottom {
  border-bottom: 1px solid var(--color-border-light);
}

.u-rounded {
  border-radius: var(--radius-md);
}

/* Background Utilities */
.u-bg-gradient-dawn {
  background: var(--gradient-dawn);
}

.u-bg-gradient-canopy {
  background: var(--gradient-canopy);
}

.u-bg-elevated {
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-sm);
}

/* ===================================================================
   PRINT STYLES
   Critical for rangers printing pages for field work
   =================================================================== */

@media print {
  /* Hide navigation, decorative elements */
  .site-header__nav-container,
  .nav-main,
  .site-header__content,
  .site-container__top-border,
  .site-container__bottom-border,
  .site-footer,
  .search-bar {
    display: none !important;
  }

  /* Reset backgrounds and colors for print */
  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.5;
  }

  .site-container,
  .site-main,
  .card {
    width: 100%;
    max-width: none;
    box-shadow: none;
    border: none;
    page-break-inside: avoid;
  }

  .card__body {
    background: white;
    padding: 0;
  }

  /* Print URLs after links */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #666;
  }

  /* Don't print internal anchor links */
  a[href^="#"]::after {
    content: "";
  }

  h1, h2, h3 {
    page-break-after: avoid;
    color: black;
  }

  /* Monospace for data in print */
  .u-mono,
  .data-table {
    font-family: 'Courier New', monospace;
  }
}
