/*
 * ACF Elementor Extended — Bundled CSS
 * Includes:
 * - Repeater Auto Controls
 * - Testimonials Widget
 * - Pro Gallery Extended
 */

/* === [Repeater Auto Controls] === */
/* === Default Styling for ACF Repeater Auto Controls === */

/* Wrapper Container (per repeater item) */
.acf-item-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1rem;
  box-sizing: border-box;
}

/* Sub Container (per subfield) */
[class*="acf-sub-container-"] {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
}

/* Element (actual field content) */
[class*="acf-element-"] {
  width: 100%;
  box-sizing: border-box;
}

/* Image defaults */
[class*="acf-element-"] img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Swiper Carousel --- */
.arls-carousel-outer {
  position: relative;
  min-height: 200px; /* Ensure minimum height for editor visibility */
}

.arls-carousel {
  overflow: hidden;
  min-height: inherit;
}

/* Ensure carousel content is visible in Elementor editor */
.elementor-editor-active .arls-carousel-outer {
  min-height: 250px;
  border: 1px dashed #ccc; /* Visual indicator in editor */
}

.elementor-editor-active .arls-carousel {
  min-height: 200px;
}

/* Ensure slides have minimum height */
.arls-carousel .swiper-slide {
  min-height: 150px;
}

.elementor-editor-active .arls-carousel .swiper-slide {
  min-height: 180px;
  border: 1px solid #eee; /* Visual indicator for slides in editor */
}

/* Grid layout visibility in editor */
.elementor-editor-active .arls-grid {
  min-height: 200px;
  border: 1px dashed #ccc; /* Visual indicator in editor */
}

.elementor-editor-active .arls-grid .acf-item-container {
  min-height: 150px;
  border: 1px solid #eee; /* Visual indicator for grid items in editor */
  padding: 10px;
}

/* Ensure ACF content is visible */
.elementor-editor-active .acf-item-container {
  background: #f9f9f9;
  border-radius: 4px;
}

/* Show placeholder content when no data */
.elementor-editor-active .arls-carousel-outer:empty::after,
.elementor-editor-active .arls-grid:empty::after {
  content: "ACF Loop Carousel - No content found. Please check your ACF field selection.";
  display: block;
  padding: 20px;
  text-align: center;
  color: #666;
  font-style: italic;
  border: 2px dashed #ddd;
  background: #f9f9f9;
}

/* Editor placeholder styling */
.arls-editor-placeholder {
  min-height: 200px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #f8f9fa !important;
  border: 2px dashed #6c757d !important;
  border-radius: 8px !important;
  margin: 10px 0 !important;
}

.arls-editor-message {
  text-align: center !important;
  padding: 30px !important;
  max-width: 400px !important;
}

.arls-editor-message h4 {
  color: #495057 !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  margin: 0 0 15px 0 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.arls-editor-message p {
  color: #6c757d !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  margin: 0 0 10px 0 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.arls-editor-message p:last-child {
  margin-bottom: 0 !important;
}

.arls-editor-message strong {
  color: #495057 !important;
  font-weight: 600 !important;
}

/* Override for Elementor control */
.elementor-widget-container .arls-carousel {
  overflow: var(--arls-carousel-overflow, hidden);
}

/* Enhanced positioning for carousel container */
.arls-carousel-outer {
  box-sizing: border-box;
  position: relative;
  overflow: visible !important; /* Ensure arrows can extend outside */
  padding: 0px; /* Add padding to accommodate outside arrows */
}

/* Limit overflow adjustments to this plugin's widgets to reduce editor repaint cost */
.elementor-widget-atw_testimonials .elementor-widget-container,
.elementor-widget-atw_acf_gallery_carousel .elementor-widget-container {
  overflow: visible;
}

/* Arrow Group for Inside Arrows */
.arls-carousel-outer .arls-arrow-group {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: var(--arls-arrow-gap, 20px);
  transform: translateY(-50%);
  pointer-events: none; /* prevent blocking slides */
  z-index: 10;
}

/* Base Arrow Styles */
.arls-arrow {
  pointer-events: all;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  z-index: 20;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
  flex-shrink: 0; /* Prevent arrows from shrinking */
}

.arls-arrow:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

/* Inside Arrow Group Positioning */
.arls-arrow-group.inside {
  justify-content: space-between;
  padding: 0 10px;
}

/* Outside Arrow Individual Positioning - Absolute positioning relative to carousel container */
.arls-arrow.outside {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999;
}

.arls-arrow.outside.arls-prev {
  left: var(--arls-arrow-left-offset, -60px);
}

.arls-arrow.outside.arls-next {
  right: var(--arls-arrow-right-offset, -60px);
}

/* Center positioning for arrow groups */
.arls-arrow-group.center {
  left: 50%;
  transform: translate(-50%, -50%);
  justify-content: center;
}

/* Pagination dots */
.swiper-pagination {
  text-align: center;
  margin-top: 15px;
}

.swiper-pagination-bullet {
  background: #aaa;
  opacity: 1;
  margin: 0 4px;
}

.swiper-pagination-bullet-active {
  background: #000;
}

/* === Draggable + Swiper Fixes === */
.acfe-draggable-container { position: relative; min-height: 250px; }
.acfe-draggable-item { cursor: grab; }
.acfe-draggable-item:active { cursor: grabbing; opacity: 0.95; box-shadow: 0 4px 14px rgba(0,0,0,.15); }

/* Fix Swiper slides width */
.arls-carousel.swiper .swiper-slide {
  flex: 0 0 auto !important;
}

/*  === Grid === */
.arls-grid {
  grid-template-columns: repeat(3, 1fr);
}
@media(max-width:1024px) {
  .arls-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media(max-width:767px) {
  .arls-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}

/* === [Testimonials Widget] === */
/* ACF Testimonials Widget Styles */

/* Base wrapper styles */
.atw-testimonials-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Error and fallback messages */
.atw-error,
.atw-fallback {
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    font-size: 14px;
    margin: 10px 0;
}

.atw-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.atw-fallback {
    color: #0c5460;
}

/* Grid Layout */
.atw-layout-grid .atw-items-container {
    display: grid;
    gap: var(--atw-space-between, 20px);
    grid-template-columns: repeat(var(--atw-columns, 3), 1fr);
}

/* List Layout */
.atw-layout-list .atw-items-container {
    display: flex;
    flex-direction: column;
    gap: var(--atw-space-between, 20px);
}

/* Testimonial Item Base Styles */
.atw-testimonial-item {
    /* Neutral defaults; styling controlled via Elementor controls */
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    transition: transform 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.atw-testimonial-item:hover {
    transform: translateY(-2px);
}

/* Carousel Specific Styles */
.atw-layout-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.atw-layout-carousel .swiper-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
}

.atw-layout-carousel .swiper-slide {
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevent slides from shrinking */
    width: auto; /* Let Swiper handle the width */
    box-sizing: border-box;
}

.atw-layout-carousel .swiper-slide .atw-testimonial-item {
    width: 100%;
    min-width: 0; /* Allow content to shrink if needed */
    box-sizing: border-box;
}

/* Gallery Carousel: Normalize logo/image sizing */
.atw-layout-carousel .atw-carousel-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: var(--atw-logo-max-height, 60px);
    max-height: var(--atw-logo-max-height, 60px);
    object-fit: var(--atw-logo-fit, contain);
    margin: 0;
    filter: var(--atw-logo-filter, none);
    opacity: var(--atw-logo-opacity, 1);
    transition: filter 200ms ease, opacity 200ms ease;
}

/* Hover behavior driven by CSS variables set via Elementor controls */
.atw-layout-carousel .swiper-slide:hover .atw-carousel-image,
.atw-layout-carousel .atw-carousel-image:hover {
    filter: var(--atw-logo-hover-filter, var(--atw-logo-filter, none));
    opacity: var(--atw-logo-hover-opacity, var(--atw-logo-opacity, 1));
}

/* Navigation Arrows */
.atw-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    z-index: 10;
    transition: background-color 0.3s ease, transform 0.3s ease;
    user-select: none;
}

/* Ensure SVG icons scale with font size */
.atw-nav svg {
    width: 1em;
    height: 1em;
}
/* Ensure arrow color controls affect SVG icons */
.atw-nav svg,
.atw-nav svg * {
    fill: currentColor;
    stroke: currentColor;
}

.atw-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

/* Default positioning for arrows inside wrapper */
.atw-nav-prev {
    left: calc(10px + var(--atw-prev-h, 0px));
}

.atw-nav-next {
    right: calc(10px + var(--atw-next-h, 0px));
}

/* Positioning for arrows outside wrapper - now they are siblings to the wrapper */
.elementor-widget-container > .atw-nav-prev {
    left: calc(-50px + var(--atw-prev-h, 0px));
}

.elementor-widget-container > .atw-nav-next {
    right: calc(-50px + var(--atw-next-h, 0px));
}

.atw-nav.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Pagination */
.swiper-pagination {
    position: relative;
    margin-top: 20px;
    text-align: center;
}

.arls-structure-ui { display: flex; gap: 10px; margin-top: 8px; }
.arls-structure-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.arls-selected, .arls-available { list-style: none; margin: 0; padding: 6px; border: 1px solid #ddd; border-radius: 4px; min-height: 60px; }
.arls-selected li, .arls-available li { padding: 6px 8px; border: 1px solid #eee; border-radius: 3px; margin-bottom: 6px; background: #fafafa; cursor: move; }
.arls-selected li:last-child, .arls-available li:last-child { margin-bottom: 0; }
.arls-structure-adder { display:flex; gap:8px; margin-top:8px; }
.arls-structure-input { flex:1; padding:6px 8px; border:1px solid #ddd; border-radius:4px; }
.arls-structure-add { padding:6px 10px; border:1px solid #ddd; background:#f7f7f7; border-radius:4px; cursor:pointer; }
.arls-subfield-group { display:none; padding:6px 0; }
.arls-subfield-group.open { display:block; }
.arls-subfield-toggle { float:right; margin-top:4px; }

.swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: #ccc;
    border-radius: 50%;
    margin: 0 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.swiper-pagination-bullet-active {
    background: #007cba;
    transform: scale(1.2);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .atw-nav {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .atw-nav {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .atw-nav-prev {
        left: 5px;
    }
    
    .atw-nav-next {
        right: 5px;
    }
}

@media (max-width: 480px) {
    .atw-nav {
        display: none; /* Hide navigation on very small screens */
    }
}

/* Loading State */
.atw-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.atw-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: atw-spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes atw-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.atw-nav:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.swiper-pagination-bullet:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .atw-nav,
    .swiper-pagination {
        display: none;
    }
    
    .atw-layout-carousel .swiper-wrapper {
        display: block;
    }
    
    .atw-layout-carousel .swiper-slide {
        display: block;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
}
/* Arrow orientation helpers */
.atw-nav.atw-vertical {
    top: calc(50% + var(--atw-prev-v, 0px));
    transform: translateY(-50%);
}
.atw-nav.atw-horizontal {
    top: calc(50% + var(--atw-next-v, 0px));
    transform: translateY(-50%);
}

/* Offset sides support */
.atw-testimonials-wrapper[data-offset-sides="left"] {
    padding-left: calc(var(--atw-offset-width, 100%) * 0.01);
}
.atw-testimonials-wrapper[data-offset-sides="right"] {
    padding-right: calc(var(--atw-offset-width, 100%) * 0.01);
}
.atw-testimonials-wrapper[data-offset-sides="both"] {
    padding-left: calc(var(--atw-offset-width, 100%) * 0.01);
    padding-right: calc(var(--atw-offset-width, 100%) * 0.01);
}
/* Updated selectors for outside arrows - they are now siblings to the wrapper */
.elementor-widget-container:has(.atw-testimonials-wrapper[data-nav-position="outside"]) > .atw-nav-prev {
    left: calc(-10px + var(--atw-prev-h, 0px));
}
.elementor-widget-container:has(.atw-testimonials-wrapper[data-nav-position="outside"]) > .atw-nav-next {
    right: calc(-55px + var(--atw-next-h, 0px));
}

/* Optional row max-width (centers when set) */
.atw-testimonials-wrapper {
    max-width: var(--atw-row-max-width, none);
    margin-left: auto;
    margin-right: auto;
}

/* === [Pro Gallery Extended] === */
/* =========================
   Pro Gallery Extended CSS
   ========================= */

.epge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 20px;
  row-gap: 20px;
}

.epge-item {
  display: flex;
  flex-direction: column;
  position: relative;
}

.epge-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Aspect Ratio Crop */
.epge-aspect {
  display: block;
  width: 100%;
  aspect-ratio: var(--epge-ratio, 4/3);
  position: relative;
  overflow: hidden;
}

.epge-aspect img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
}

/* Hover Effects */
.epge-hover-zoom img:hover { transform: scale(1.1); }
.epge-hover-grayscale img:hover { filter: grayscale(100%); }
.epge-hover-blur img:hover { filter: blur(3px); }

/* Overlay */
.epge-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  opacity: 0;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.45);
  transition: opacity .3s ease;
}

.epge-item:hover .epge-overlay {
  opacity: 1;
}

.epge-overlay.align-top    { align-items: flex-start; }
.epge-overlay.align-center { align-items: center; }
.epge-overlay.align-bottom { align-items: flex-end; }

.epge-overlay-inner {
  width: 100%;
  text-align: center;
  padding: 10px;
  color: #fff;
}

/* Meta (when below image) */
.epge-meta {
  margin-top: 8px;
}

.epge-title, .epge-caption, .epge-description {
  line-height: 1.4;
  margin: 3px 0;
}

/* Responsive columns */
@media (max-width: 1024px) {
  .epge-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 767px) {
  .epge-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}

/* Justified Layout */
.layout-justified .epge-grid {
  display: flex;
  flex-wrap: wrap;
}
.layout-justified .epge-item {
  flex-grow: 1;
  flex-basis: auto;
}

/* Masonry fallback (uses JS) */
.layout-masonry .epge-grid {
  column-count: 3;
  column-gap: 20px;
}
.layout-masonry .epge-item {
  break-inside: avoid;
  margin-bottom: 20px;
}
