/**
 * @file
 * Main layout styles for Invertir Pro theme.
 */

/* ========================================
 * PAGE WRAPPER
 * ======================================== */

.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========================================
 * MAIN CONTENT AREA
 * ======================================== */

.main-content {
  flex: 1;
  padding-top: var(--space-sm);
  padding-bottom: var(--space-3xl);
}

.main-content__wrapper {
  width: 100%;
}

.main-content__container {
  width: 100%;
}

/* ========================================
 * GRID LAYOUTS
 * ======================================== */

.main-content__grid {
  display: grid;
  gap: var(--space-xl);
}

/* Single column (default) */
.layout--single-column {
  grid-template-columns: 1fr;
}

.layout--single-column .content-region {
  max-width: 100%;
}

/* Sidebar left (filters) */
.layout--sidebar-left {
  grid-template-columns: 1fr;
}

@media (min-width: 992px) {
  .layout--sidebar-left {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
}

/* Sidebar right */
.layout--sidebar-right {
  grid-template-columns: 1fr;
}

@media (min-width: 992px) {
  .layout--sidebar-right {
    grid-template-columns: 1fr var(--sidebar-width-wide);
  }
}

/* Three column (both sidebars) */
.layout--three-column {
  grid-template-columns: 1fr;
}

@media (min-width: 992px) {
  .layout--three-column {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
}

@media (min-width: 1200px) {
  .layout--three-column {
    grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
  }
}

/* ========================================
 * SIDEBARS
 * ======================================== */

.sidebar-filters,
.sidebar-right {
  position: relative;
}

/* Mobile: filters collapse/expand */
@media (max-width: 991px) {
  .sidebar-filters {
    order: -1;
    background-color: var(--color-bg-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
  }
}

/* Desktop: sticky sidebar */
@media (min-width: 992px) {
  .sidebar-filters,
  .sidebar-right {
    position: sticky;
    top: calc(var(--header-height-scrolled) + var(--space-lg));
    align-self: start;
    max-height: calc(100vh - var(--header-height-scrolled) - var(--space-2xl));
    overflow-y: auto;
  }
}

/* ========================================
 * CONTENT REGION
 * ======================================== */

.content-region {
  min-width: 0; /* Prevent grid blowout */
}

/* ========================================
 * UTILITY BAR
 * ======================================== */

.utility-bar {
  background-color: var(--color-white);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  padding: var(--space-3xs) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.utility-bar__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Hide on mobile */
@media (max-width: 767px) {
  .utility-bar {
    display: none;
  }
}

/* ========================================
 * HERO REGION
 * ======================================== */

.hero-region {
  width: 100%;
  background-color: var(--color-bg-cream);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* ========================================
 * BREADCRUMB REGION
 * ======================================== */

.breadcrumb-region {
  background-color: var(--color-bg-light);
  padding: var(--space-md) 0;
}

/* ========================================
 * HIGHLIGHTED REGION
 * ======================================== */

.highlighted-region {
  padding: 0;
  margin: 0;
}

.highlighted-region:not(:has(*)) {
  display: none;
}

/* ========================================
 * CONTENT ABOVE/BELOW REGIONS
 * ======================================== */

.content-below-region {
  padding-top: var(--space-xl);
  background-color: var(--color-bg-light);
}

/* ========================================
 * FULL WIDTH SECTIONS
 * ======================================== */

.full-width-section {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

/* ========================================
 * RESPONSIVE ADJUSTMENTS
 * ======================================== */

@media (max-width: 767px) {
  .page-wrapper {
    overflow-x: hidden;
  }

  .main-content {
    padding-top: var(--space-sm);
    padding-bottom: var(--space-2xl);
  }

  .main-content__grid {
    gap: var(--space-lg);
  }
}
