/**
 * Lapso Mindbody - Studios Styles
 */

/* ==========================================================================
   Variables
   ========================================================================== */
:root {
  --lapso-studios-primary: #8b2d1d;
  --lapso-studios-primary-hover: #6b2316;
  --lapso-studios-text: #1f2937;
  --lapso-studios-text-light: #6b7280;
  --lapso-studios-bg: #ffffff;
  --lapso-studios-border: #e5e7eb;
  --lapso-studios-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --lapso-studios-radius: 12px;
}

/* ==========================================================================
   Studios Grid
   ========================================================================== */
.lapso-studios-wrapper {
  width: 100%;
  font-family: "Matter", "Montserrat", sans-serif !important;
  /* Safari mobile: ensure parent calculates height correctly */
  flex-shrink: 0;
  min-height: -webkit-fit-content;
  min-height: fit-content;
  overflow: visible;
  display: block;
  height: auto;
}

.lapso-studios-wrapper h1,
.lapso-studios-wrapper h2,
.lapso-studios-wrapper h3,
.lapso-studios-wrapper h4,
.lapso-studios-wrapper h5,
.lapso-studios-wrapper h6,
.lapso-studios-wrapper p,
.lapso-studios-wrapper span,
.lapso-studios-wrapper a,
.lapso-studios-wrapper button {
  font-family: "Matter", "Montserrat", sans-serif !important;
}

.lapso-studios-grid {
  display: grid;
  gap: 24px;
  /* Safari mobile: force grid to report its full height */
  min-height: -webkit-fit-content;
  min-height: fit-content;
  height: auto;
}

.lapso-studios-cols-1 {
  grid-template-columns: 1fr;
}

.lapso-studios-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.lapso-studios-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.lapso-studios-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Responsive grid */
@media (max-width: 1024px) {
  .lapso-studios-cols-4,
  .lapso-studios-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .lapso-studios-cols-4,
  .lapso-studios-cols-3,
  .lapso-studios-cols-2 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Studio Card
   ========================================================================== */
.lapso-studio-card {
  background-color: var(--lapso-studios-bg);
  border-radius: var(--lapso-studios-radius);
  overflow: hidden;
  box-shadow: var(--lapso-studios-shadow);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.lapso-studio-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Studio Cover
   ========================================================================== */
.lapso-studio-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 4/5;
  overflow: hidden;
  background-color: #f3f4f6;
}

.lapso-studio-cover img {
  display: block;
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  transition: transform 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  max-width: none !important;
}

.lapso-studio-card:hover .lapso-studio-cover img {
  transform: scale(1.05);
}

.lapso-studio-cover-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

/* ==========================================================================
   Studio Badges
   ========================================================================== */
.lapso-studio-badges {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lapso-studio-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background-color: var(--lapso-studios-bg);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--lapso-studios-text);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lapso-studio-badge svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ==========================================================================
   Studio Content
   ========================================================================== */
.lapso-studio-content {
  padding: 20px;
  font-family: "Matter", "Montserrat", sans-serif !important;
}

.lapso-studio-name {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--lapso-studios-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: break-word;
}

.lapso-studio-address {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--lapso-studios-primary);
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ==========================================================================
   Studio Meta
   ========================================================================== */
.lapso-studio-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.lapso-studio-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--lapso-studios-text-light);
}

.lapso-studio-type svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* ==========================================================================
   Studio Button
   ========================================================================== */
.lapso-studio-button {
  display: block;
  width: 100%;
  padding: 12px 24px;
  background-color: var(--lapso-studios-primary);
  color: #fff !important;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lapso-studio-button:hover {
  background-color: var(--lapso-studios-primary-hover);
  color: #fff !important;
  text-decoration: none;
}

.lapso-studio-button:visited,
.lapso-studio-button:focus,
.lapso-studio-button:active {
  color: #fff !important;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.lapso-studios-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--lapso-studios-text-light);
  font-size: 16px;
}

/* ==========================================================================
   Mobile Overrides
   ========================================================================== */
@media (max-width: 640px) {
  .lapso-studios-grid {
    gap: 16px;
    max-width: 100%;
    padding: 0 12px;
    margin: 0 auto;
  }

  .lapso-studio-cover {
    aspect-ratio: 4 / 3;
  }

  .lapso-studio-content {
    padding: 16px;
  }

  .lapso-studio-name {
    font-size: 16px;
    margin-bottom: 6px;
    line-height: 1.35;
  }

  .lapso-studio-address {
    font-size: 13px;
    margin-bottom: 10px;
    line-height: 1.45;
  }

  .lapso-studio-badge {
    padding: 5px 10px;
    font-size: 12px;
  }

  .lapso-studio-button {
    padding: 10px 20px;
    font-size: 13px;
  }

  .lapso-studio-meta {
    margin-bottom: 10px;
  }

  .lapso-studios-wrapper {
    -webkit-transform: translateZ(0);
    overflow: visible;
    position: relative;
    /* Safari mobile: force layout recalc */
    -webkit-appearance: none;
  }

  .lapso-studios-grid {
    min-height: -webkit-fit-content;
    min-height: fit-content;
  }

  .lapso-studio-card {
    /* Safari mobile: ensure cards contribute to parent height */
    -webkit-transform: translateZ(0);
    position: relative;
  }
}

/* ==========================================================================
   Elementor Compatibility — Mobile Height Fix
   Forces Elementor flex containers to properly wrap studio cards content.
   The e-con containers default to min-height values that prevent them from
   growing with their children in Safari mobile.
   ========================================================================== */

/* Reset min-height on the Elementor container holding the shortcode */
.e-con.e-parent:has(.lapso-studios-wrapper) {
  min-height: 0 !important;
  height: auto !important;
}

.e-con.e-parent:has(.lapso-studios-wrapper) > .e-con-inner {
  min-height: 0;
  height: auto;
}

/* Ensure shortcode widget container doesn't collapse */
.e-con
  .elementor-widget-shortcode:has(.lapso-studios-wrapper)
  .elementor-widget-container,
.e-con
  .elementor-widget-shortcode:has(.lapso-studios-wrapper)
  .elementor-shortcode {
  display: block;
  height: auto;
}
