/**
 * @file
 * CAGP News Slider Styling
 * Matches legacy Views Slideshow + Display Suite layout
 */

/* Slider Section Container */
.slider-section {
  margin-bottom: 30px;
  background: #ffffff;
}

.slider-section h2 {
  font-size: 24px;
  color: #333;
  margin: 0;
  padding: 15px 20px;
  background: #f5f5f5;
  border-left: 4px solid #2c5aa0;
  font-weight: normal;
  border-bottom: 1px solid #e6e6e6;
}

/* View Container */
.view-news-slider {
  position: relative;
  min-height: 380px;
}

.view-news-slider .view-content {
  position: relative;
  overflow: hidden;
}

/* Slide Structure - CSS Grid for both views-row (before JS) and li (after bxSlider) */
.view-news-slider .views-row,
.view-news-slider .bxslider li {
  display: grid !important;
  grid-template-columns: 1fr 1fr; /* Two equal columns */
  grid-template-rows: auto auto auto 1fr; /* Rows for title, body, link, and remaining space */
  min-height: 380px;
  background: #ffffff;
  gap: 0;
}

/* Content fields (left column) */
.view-news-slider .views-field-title {
  grid-column: 1;
  grid-row: 1;
  padding: 20px 2% 10px 2%;
  visibility: visible !important;
  opacity: 1 !important;
}

.view-news-slider .views-field-body {
  grid-column: 1;
  grid-row: 2;
  padding: 0 2% 15px 2%;
  visibility: visible !important;
  opacity: 1 !important;
}

.view-news-slider .views-field-field-link {
  grid-column: 1;
  grid-row: 3;
  padding: 0 2% 20px 2%;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Image Section (right column - spans all rows) */
.view-news-slider .views-field-field-slider-image {
  grid-column: 2;
  grid-row: 1 / -1; /* Span from first to last row */
  height: 100%;
  min-height: 380px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
}

.view-news-slider .views-field-field-slider-image img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* Clickable image link */
.view-news-slider .views-field-field-slider-image a.image-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  transition: opacity 0.3s ease;
}

.view-news-slider .views-field-field-slider-image a.image-link:hover {
  opacity: 0.9;
  cursor: pointer;
}

.view-news-slider .views-field-field-slider-image a.image-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Title Styling */
.view-news-slider .views-field-title {
  margin-bottom: 15px;
  display: block !important;
}

.view-news-slider .views-field-title .field-content,
.view-news-slider .views-field-title a,
.view-news-slider .views-field-title a.title-link {
  color: #ff6000;
  display: block;
  text-transform: uppercase;
  font-family: ClearSans-Medium, Arial, sans-serif;
  font-weight: normal;
  font-size: 16px;
  line-height: 1.4;
  text-decoration: none;
}

.view-news-slider .views-field-title a:hover,
.view-news-slider .views-field-title a.title-link:hover {
  text-decoration: underline;
}

/* Body/Description */
.view-news-slider .views-field-body {
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  display: block !important;
}

.view-news-slider .views-field-body .field-content {
  display: block !important;
}

.view-news-slider .views-field-body p {
  color: #333;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 10px;
}

/* Clickable body link */
.view-news-slider .views-field-body a.body-link {
  color: #333;
  text-decoration: none;
  display: block;
}

.view-news-slider .views-field-body a.body-link:hover {
  color: #2c5aa0;
}

/* Link field */
.view-news-slider .views-field-field-link {
  display: block !important;
}

/* Button/Link Styling - matches legacy .btn.slide-btn */
.view-news-slider .views-field-field-link a {
  font-family: ClearSans-Medium, Arial, sans-serif;
  background: #253980;
  border-radius: 3px;
  color: #ffffff;
  display: inline-block;
  font-size: 15px;
  line-height: 37px;
  min-width: 165px;
  text-align: center;
  text-transform: uppercase;
  padding: 0 15px;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.view-news-slider .views-field-field-link a:hover {
  background: #1a2a60;
}

/* bxSlider Controls Styling */
.view-news-slider .bx-wrapper {
  margin-bottom: 15px;
  box-shadow: none;
  border: none;
  background: transparent;
  min-height: 380px !important;
  height: auto !important;
}

.view-news-slider .bx-wrapper .bx-viewport {
  left: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  min-height: 380px !important;
  height: auto !important;
}

/* Hide the bx-loading overlay that covers content */
.view-news-slider .bx-wrapper .bx-loading {
  display: none !important;
}

/* Ensure bxSlider UL and LI have proper height and visibility */
.view-news-slider .bxslider {
  min-height: 380px !important;
  height: 380px !important;
  list-style: none;
  margin: 0;
  padding: 0;
  opacity: 1 !important;
  visibility: visible !important;
}

.view-news-slider .bxslider li {
  list-style: none;
  margin: 0;
  padding: 0;
  /* bxSlider uses position: absolute for fade mode - keep it but ensure it's visible */
  width: 100% !important;
  height: 380px !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Previous/Next Controls */
.view-news-slider .bx-controls-direction a {
  position: absolute;
  top: 50%;
  margin-top: -20px;
  width: 40px;
  height: 40px;
  background: rgba(37, 57, 128, 0.8);
  color: #ffffff;
  text-indent: -9999px;
  z-index: 10;
  transition: background-color 0.3s ease;
}

.view-news-slider .bx-controls-direction a:hover {
  background: rgba(37, 57, 128, 1);
}

.view-news-slider .bx-controls-direction a.bx-prev {
  left: 10px;
}

.view-news-slider .bx-controls-direction a.bx-next {
  right: 10px;
}

.view-news-slider .bx-controls-direction a.bx-prev:after,
.view-news-slider .bx-controls-direction a.bx-next:after {
  font-family: FontAwesome, Arial, sans-serif;
  font-size: 20px;
  text-indent: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-news-slider .bx-controls-direction a.bx-prev:after {
  content: "\f053"; /* FontAwesome left arrow */
}

.view-news-slider .bx-controls-direction a.bx-next:after {
  content: "\f054"; /* FontAwesome right arrow */
}

/* Auto Controls (Play/Pause) */
.view-news-slider .bx-controls-auto {
  text-align: center;
  padding: 10px 0;
}

.view-news-slider .bx-controls-auto a {
  display: inline-block;
  padding: 8px 20px;
  background: #253980;
  color: #ffffff;
  text-decoration: none;
  border-radius: 3px;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.view-news-slider .bx-controls-auto a:hover {
  background: #1a2a60;
}

/* Loading state - applies to both view-content and bxslider */
.view-news-slider:not(.slider-loaded) .view-content,
.view-news-slider:not(.slider-loaded) .bxslider {
  opacity: 0;
}

.view-news-slider.slider-loaded .view-content,
.view-news-slider.slider-loaded .bxslider {
  opacity: 1 !important;
  transition: opacity 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .view-news-slider .views-row {
    grid-template-columns: 1fr; /* Single column on mobile */
    grid-template-rows: auto; /* Auto rows */
    min-height: auto;
  }

  .view-news-slider .views-field-title,
  .view-news-slider .views-field-body,
  .view-news-slider .views-field-field-link {
    grid-column: 1;
    grid-row: auto;
  }

  .view-news-slider .views-field-field-slider-image {
    grid-column: 1;
    grid-row: auto;
    height: 250px;
    min-height: 250px;
  }

  .view-news-slider .bx-controls-direction a {
    width: 30px;
    height: 30px;
    margin-top: -15px;
  }
}
