/*
 * Section Element Styles
 * Created for USFleetTracking.com
 * Includes Universal Content Section Styles for GPS pages
 */

/* Base Section Styles */
section {
  padding: 6rem 0;
  position: relative;
  overflow: hidden;
}

/* Section Size Variants */
section.section-sm {
  padding: 3rem 0;
}

section.section-lg {
  padding: 8rem 0;
}

/* Section with Background */
section.bg-gray-50 {
  background-color: var(--color-bg-light);
  position: relative;
}

section.bg-gray-50::before,
section.bg-gray-50::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0.05;
  z-index: 0;
}

section.bg-gray-50::before {
  top: -150px;
  left: -150px;
}

section.bg-gray-50::after {
  bottom: -150px;
  right: -150px;
}

/* Section Title */
.section-title {
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

/* Section Heading */
.section-heading {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-lg);
  position: relative;
  padding-bottom: var(--spacing-sm);
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background-color: var(--color-primary);
}

.section-base {   
  margin: 0; 
  padding: 1em;
}

/* Design System Variables */
:root {
  --section-padding: 1rem 0;
  --section-gap: 2rem;
  --card-padding: 2rem;
  --card-radius: 8px;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.1);
  --primary-color: #0a4275;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
}

/* Standardized Section Layout */
.section-base {
  padding: var(--section-padding);
  margin-bottom: 1rem;
}

.section-base.bg-gray-50 {
  background-color: var(--gray-50);
}

/* High specificity to override card flex-direction */
article.card .section-row,
.container.card .section-row,
.card .section-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--section-gap);
  width: 100%;
}

/* Ensure flex items work properly within cards */
article.card .article-flex-content,
article.card .article-flex-image,
.container.card .article-flex-content,
.container.card .article-flex-image,
.card .article-flex-content,
.card .article-flex-image {
  flex: 1;
  min-width: 0;
  width: auto;
}

/* Standardized Card Styling */
.card {
  background: white;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: var(--card-padding);
}

/* Responsive Design */
@media (max-width: 768px) {
  .section-row {
    flex-direction: column;
    gap: 1.5rem;
  }

  .article-flex-content,
  .article-flex-image {
    flex: none;
    width: 100%;
  }
}

/* Responsive Adjustments */
@media only screen and (max-width: 768px) {
  section {
    background-color: white;
    padding: 4rem 0;
  }

  section.section-sm {
    padding: 2rem 0;
  }

  section.section-lg {
    padding: 6rem 0;
  }

  .section-row {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .article-flex-content,
  .article-flex-image {
    width: 100%;
    flex: none;
  }
}

/* ===== UNIVERSAL CONTENT SECTION STYLES ===== */
/* Supports alternating image/content layouts for visual flow */

/* Section Header Styles */
.content-section-header {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.content-section-heading {
  width: 100%;
  margin-bottom: 1rem;
}

.content-section-intro {
  width: 100%;
  margin-bottom: 1.5rem;
}

/* Content Area Styles */
.content-section-content {
  min-height: 340px;
}

.content-section-image {
  min-height: 340px;
}

/* Content Elements */
.content-section-subheading {
  margin-bottom: 1rem;
}

.content-section-list {
  padding-left: 24px;
  margin-bottom: 1rem;
}

.content-section-conclusion {
  margin-bottom: 1rem;
}

/* Button/CTA Styles */
.content-section-cta {
  margin-top: 1rem;
}

.content-section-button {
  display: inline-block;
  color: #ffffff;
  border-radius: 0.5rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  background-color: #2563eb;
  transition: background-color 0.2s ease;
  text-decoration: none;
}

.content-section-button:hover {
  background-color: #1d4ed8;
}

/* Error styling for missing CTA data */
.content-section-error {
  padding: 1rem 1.5rem;
  background-color: #fef2f2;
  border: 2px solid #fca5a5;
  border-radius: 0.5rem;
  color: #dc2626;
  font-weight: 500;
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.5;
  font-family: monospace;
}

.content-section-error strong {
  font-weight: 700;
  color: #991b1b;
}

/* Layout Classes for Image/Content Positioning */
/* Applied to .section-row element which contains the flex children */

/* Content Left, Image Right (default) */
.section-row.layout-content-left {
  display: flex;
}

.section-row.layout-content-left .article-flex-content {
  order: 1;
}

.section-row.layout-content-left .article-flex-image {
  order: 2;
}

/* Image Left, Content Right */
.section-row.layout-image-left {
  display: flex;
}

.section-row.layout-image-left .article-flex-content {
  order: 2;
}

.section-row.layout-image-left .article-flex-image {
  order: 1;
}

/* Background Variants */
.content-section-bg-gray {
  background-color: #f9fafb;
}

.content-section-bg-white {
  background-color: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .content-section-content,
  .content-section-image {
    min-height: auto;
  }

  .content-section-list {
    padding-left: 20px;
  }

  /* On mobile, always show content first, then image */
  .section-row.layout-content-left .article-flex-content,
  .section-row.layout-image-left .article-flex-content {
    order: 1;
  }

  .section-row.layout-content-left .article-flex-image,
  .section-row.layout-image-left .article-flex-image {
    order: 2;
  }
}
