/**
 * Course Module Single Post Template Styles
 *
 * @since 2.7.0
 * @package Euka
 * @author Euka Team
 */

/* === START: Euka course-module elements shared === */
.course-module-page-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.course-module-page-section > div {
  max-width: 954px;
  padding: 0 1rem;
}

.course-module-container-flex-row {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  gap: 2rem;
  flex-wrap: wrap;
}

.course-module-meta-item {
  flex: 1;
  min-width: 200px;
  padding: 1rem;
  background-color: #F7FAFC;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
}

.course-module-meta-item p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
}

.course-module-featured-image {
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 2rem;
  width: 100%;
}

.course-module-featured-image img {
  width: 100%;
  height: auto;
  display: block;
}

#course-module-page-header {
  padding-top: 8rem;
}

#course-module-page-header h1 {
  margin-bottom: 2rem;
  text-align: center;
}

/* Video Section */
#course-module-page-video {
  padding: 2rem 0;
}

/* Wrapper contains both video and navigation */
.course-module-video-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 5px 5px #E2E8F0;
}

.course-module-video-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  background-color: #000;
  /* Removed min-height to allow container to fit video content exactly */
  border-radius: 16px 16px 0 0; /* Round top corners only */
  overflow: hidden;
}

/* Target HubSpot embed divs */
#course-module-page-video.course-module-page-section > div {
  max-width:initial
}
.course-module-video-container > div {
  width: 70rem;
  height: 100%;
  /* Removed min-height to allow container to fit video content exactly */
}

/* Target iframes inside HubSpot embeds or direct iframe embeds */
.course-module-video-container iframe,
.course-module-video-container > div iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}

/* HubSpot Video Placeholder (Local Development Only) */
.hubspot-video-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  border-radius: 16px;
  border: 2px dashed #cbd5e0;
}

.hubspot-video-placeholder .placeholder-content {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 500px;
}

.hubspot-video-placeholder svg {
  margin: 0 auto 1.5rem;
  opacity: 0.8;
}

.hubspot-video-placeholder h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.75rem;
}

.hubspot-video-placeholder p {
  font-size: 1rem;
  color: #4a5568;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.hubspot-video-placeholder .placeholder-note {
  font-size: 0.875rem;
  color: #718096;
  font-style: italic;
  margin-top: 1rem;
}

/* Target HubSpot video player specifically */
.course-module-video-container video,
.course-module-video-container > div video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  display: block;
}

/* Module Attributes Section */
#course-module-page-attributes {
  padding: 2rem;
  background-color: #FFFFFF;
}

#course-module-page-attributes h2 {
  margin-bottom: 2rem;
  text-align: center;
}

.course-module-attributes-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0rem;
  align-items: center;
}

/* Small bubble tag style for Duration and Level */
.course-module-attribute-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: all 0.2s ease-in-out;
  white-space: nowrap;
}

/* Different Bark colors for each tag */
.course-module-attribute-item:nth-child(1) {
  background-color: #DDF9FF; /* Action lightest */
  border-color: #A8E8FC; /* Action light */
}

.course-module-attribute-item:nth-child(1):hover {
  background-color: #A8E8FC;
  border-color: #00A4DB;
}

.course-module-attribute-item:nth-child(2) {
  background-color: #F0FFDE; /* Success lightest */
  border-color: #D3F1AD; /* Success light */
}

.course-module-attribute-item:nth-child(2):hover {
  background-color: #D3F1AD;
  border-color: #B6DE83;
}

.course-module-attribute-item:nth-child(3) {
  background-color: #FFF7D6; /* Warning lightest */
  border-color: #FFE788; /* Warning light */
}

.course-module-attribute-item:nth-child(3):hover {
  background-color: #FFE788;
  border-color: #F0A32F;
}

.course-module-attribute-item:nth-child(4) {
  background-color: #F7FAFC; /* Base lightest */
  border-color: #E2E8F0; /* Base light */
}

.course-module-attribute-item:nth-child(4):hover {
  background-color: #EDF2F7;
  border-color: #CBD5E0;
}

.course-module-attribute-item h3 {
  line-height: 12px;
  font-size: 12px;
  font-weight: 900;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.course-module-attribute-item p {
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  color: #2B2C3D;
  font-weight: 500;
}

/* Full-width items for Learning Objectives and Resources */
.course-module-attribute-full {
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: 16px;
}

.course-module-attribute-full h3 {
  color: #2B2C3D;
  text-transform: none;
  letter-spacing: normal;
}

.course-module-attribute-full p {
  font-size: 16px;
  line-height: 1.6;
  color: #4A5568;
  font-weight: 400;
}

/* Content Section */
#course-module-content {
  padding : 2rem;
}

#course-module-content h2,
#course-module-page-related h2,
#course-module-page-socials h2 {
  margin-bottom: 1.5rem;
}

#course-module-page-related {
  padding: 3rem 0;
  background-color: #F7FAFC;
}

#course-module-page-related h2 {
  text-align: center;
  margin-bottom: 3rem;
}

.course-module-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.course-module-related-item {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.course-module-related-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.course-module-related-item img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.course-module-related-item h3 {
  padding: 1rem 1.5rem 0.5rem;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.course-module-related-item h3 a {
  color: #2B2C3D;
  text-decoration: none;
}

.course-module-related-item h3 a:hover {
  color: #4A5568;
}

.course-module-related-item .course-module-excerpt {
  padding: 0 1.5rem 1.5rem;
  font-size: 14px;
  color: #4A5568;
  line-height: 1.6;
}

#course-module-page-socials {
  padding: 2rem;
}

#course-module-page-socials h2 {
  text-align: center;
  margin-bottom: 3rem;
}

.course-module-objectives-content ul,
.course-module-resources-content ul {
  list-style-type: disc;
  padding-left: 2rem;
  margin: 1rem 0;
}

.course-module-objectives-content li,
.course-module-resources-content li {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.course-module-overflow-bg {
  position: relative;
}

.single-course-module  #course-module-page-header::before {
  content: "";
  background: #F7D44F;
  height: 25rem;
  width: 100%;
  display: block;
  position: absolute;
  top: 0;
  z-index: -1;
}

/* Responsive styles */
@media (max-width: 48em) {
  .course-module-container-flex-row {
    flex-direction: column;
    gap: 1rem;
  }

  .course-module-meta-item {
    width: 100%;
  }

  .course-module-attributes-grid {
    gap: 0.4rem;
  }

  .course-module-attribute-item {
    padding: 0.35rem 0.85rem;
  }

  .course-module-attribute-item h3,
  .course-module-attribute-item p {
    font-size: 11px;
  }

  .course-module-related-grid {
    grid-template-columns: 1fr;
  }

  #course-module-page-header {
    padding-top: 6rem;
  }

  /* Video container uses aspect-ratio instead of min-height */
}

@media (max-width: 768px) {
  .course-module-page-section > div {
    padding: 0 0.5rem;
  }

  .course-module-video-container,
  .course-module-video-container > div,
  .course-module-video-container iframe,
  .course-module-video-container > div iframe {
    max-width: 95vw;
  }
}

/* Testimonial Table Elements */
figure.wp-block-table.testimonial-element {
  background-color: #fffdf5;
}

figure.wp-block-table.testimonial-element .has-fixed-layout td {
  padding: 2em 2em;
  border: none;
  border-left: 0.2em #e8a838 solid;
}

figure.wp-block-table.testimonial-element .has-fixed-layout td em {
  display: block;
  margin-bottom: -1.1em;
}

figure.wp-block-table.testimonial-element .has-fixed-layout td strong {
  font-size: 0.8em;
}

/* Content Heading Overrides */
.single-course-module #course-module-content h3 {
  font-size: 16px !important;
  font-weight: 900;
}

/* Course Module Slider - "Other course modules" */
#course-module-page-slider {
  padding: 3rem 0;
  background-color: #F7FAFC;
}

#course-module-page-slider h2 {
  text-align: center;
  margin-bottom: 3rem;
}

.euka-course-module-slider {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.euka-course-module-slides-container {
  overflow: hidden;
  max-width: calc(100vw - 10rem);
}

.euka-course-module-slider button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 2rem;
  height: 2rem;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E0;
  border-radius: 2rem;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

.euka-course-module-slider button:hover:not(:disabled) {
  background-color: #F7FAFC;
}

.euka-course-module-slider button.euka-course-module-slider-next,
.euka-course-module-slider button.euka-course-module-slider-prev {
  flex-shrink: 0;
  transition: opacity 0.25s ease-in-out;
}

.euka-course-module-slider button.euka-course-module-slider-next:disabled,
.euka-course-module-slider button.euka-course-module-slider-prev:disabled {
  opacity: 0.33;
  cursor: default;
}

.euka-course-module-slider button.euka-course-module-slider-next img,
.euka-course-module-slider button.euka-course-module-slider-prev img {
  max-width: 0.75rem;
}

.euka-course-module-slider button.euka-course-module-slider-next img {
  rotate: 90deg;
}

.euka-course-module-slider button.euka-course-module-slider-prev img {
  rotate: -90deg;
}

.euka-course-module-slider-slides {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 1.5rem;
  width: fit-content;
  position: relative;
  right: 0;
  transition: right 0.3s ease-in-out;
}

.euka-course-module-slider-slide {
  width: 280px;
  min-height: 12rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.euka-course-module-slider-slide:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.euka-course-module-slider-slide.euka-course-module-active {
  display: none;
}

.euka-course-module-thumbnail {
  flex-shrink: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #F7FAFC;
}

.euka-course-module-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.euka-course-module-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
}

.course-module-card-title {
  font-family: "inter", sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: #2B2C3D;
  line-height: 1.4;
}

.course-module-card-meta {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.course-module-card-duration,
.course-module-card-level {
  font-size: 12px;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  background-color: #EDF2F7;
  color: #4A5568;
}

.course-module-card-excerpt {
  font-size: 14px;
  color: #4A5568;
  line-height: 1.6;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Hosts Section - EXACT copy from podcast template */
.single-course-module #course-module-page-hosts {
  padding: 2rem;
}

.single-course-module #course-module-page-hosts h2 {
  margin-bottom: 0;
}

.single-course-module #course-module-page-hosts div {
  padding: 0;
  gap: 0;
}

.single-course-module #course-module-page-hosts > div {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.single-course-module #course-module-page-hosts > div > div {
  margin-bottom: 2rem;
  align-items: flex-start;
  gap: 2rem;
}

.single-course-module #course-module-page-hosts h4 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 1rem;
}

.single-course-module #course-module-page-hosts p {
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.single-course-module #course-module-page-hosts .podcast-host-profile-picture {
  margin: 0;
  padding: 0;
}

.single-course-module #course-module-page-hosts .podcast-host-profile-picture img {
  max-width: 264px;
  border-radius: 2rem;
}

.single-course-module #course-module-page-hosts .podcast-host-socials {
  margin: 0;
  padding: 0;
  gap: 1rem;
}

.single-course-module #course-module-page-hosts .podcast-host-socials figure {
  padding: 0;
}

.single-course-module #course-module-page-hosts .podcast-host-socials figure a {
  width: fit-content;
  height: fit-content;
  transform: 0;
}

.single-course-module #course-module-page-hosts .podcast-host-socials figure img {
  max-width: 2rem;
}

#course-module-page-hosts .wp-block-group {
  flex-wrap:nowrap;
}

/* Responsive adjustments for slider */
@media (max-width: 768px) {
  .euka-course-module-slides-container {
    max-width: calc(100vw - 6rem);
    height: auto !important; /* Override JS height on mobile - single row only */
  }

  .euka-course-module-slider-slide {
    width: 260px;
    height: auto !important; /* Let content determine height on mobile */
  }
}

/* Responsive adjustments for hosts section - EXACT podcast template */
@media (max-width: 768px) {
  .single-course-module #course-module-page-hosts > div > div.wp-block-group {
    flex-direction: column;
    align-items: center;
  }

  #course-module-page-hosts > div > .wp-block-group:nth-child(odd) {
    flex-direction: column-reverse;
  }

  .single-course-module #course-module-page-hosts > div > div.wp-block-group .podcast-host-socials {
    margin: 0 auto;
  }
}

/* -------------------------------------------------------
    COURSE MODULE NAVIGATION ARROWS
    ------------------------------------------------------- */

/* Video container with navigation */
/* Navigation container - positioned directly below video */
.course-module-nav-container {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 0;
  width: 100%;
  position: relative;
  z-index: 10;
  border-top: 1px solid #E2E8F0; /* Thin top border */
}

.course-module-nav-arrow {
  position: relative;
  flex: 1;
  min-height: 56px;
  height: auto;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 12px 24px;
}

.course-module-nav-arrow:hover:not(.disabled) {
  background: transparent;
}

.course-module-nav-arrow:active:not(.disabled) {
  background: transparent;
}

/* Disabled state */
.course-module-nav-arrow.disabled {
  background: transparent;
  cursor: not-allowed;
  opacity: 0.6;
}

.course-module-nav-arrow.disabled svg {
  fill: #718096; /* Bark base-dark */
}

.course-module-nav-arrow.disabled .course-module-nav-label {
  color: #718096; /* Bark base-dark */
}

.course-module-nav-arrow.prev {
  justify-content: flex-start;
  border-bottom-left-radius: 10px;
}

.course-module-nav-arrow.prev .course-module-nav-label {
  align-items: flex-start;
}

.course-module-nav-arrow.next {
  justify-content: flex-end;
  border-bottom-right-radius: 10px;
  flex-direction: row;
}

.course-module-nav-arrow.next .course-module-nav-label {
  align-items: flex-end;
  text-align: right;
}

.course-module-nav-arrow svg {
  width: 16px;
  height: 16px;
  fill: #0a0a0a; /* Default text color */
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.course-module-nav-arrow:hover:not(.disabled) svg {
  fill: #1468a0; /* Link hover color */
}

/* Text label for navigation */
.course-module-nav-label {
  color: #0a0a0a; /* Default text color */
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  overflow: hidden;
}

.course-module-nav-arrow:hover:not(.disabled) .course-module-nav-label {
  color: #1468a0; /* Link hover color */
}

/* Prefix text (smaller - on first line) */
.course-module-nav-prefix {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

/* Module title (normal size - on second line) */
.course-module-nav-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Tooltip - hidden in new design, labels are always visible */
.course-module-nav-tooltip {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .course-module-nav-arrow {
    padding: 10px 16px;
    min-height: 48px;
  }
  
  .course-module-nav-prefix {
    font-size: 11px;
  }
  
  .course-module-nav-title {
    font-size: 13px;
  }
  
  .course-module-nav-arrow svg {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 480px) {
  .course-module-nav-arrow {
    padding: 8px 12px;
    min-height: 44px;
  }
  
  .course-module-nav-prefix {
    font-size: 10px;
  }
  
  .course-module-nav-title {
    font-size: 12px;
  }
  
  .course-module-nav-arrow svg {
    width: 14px;
    height: 14px;
  }
}

/* -------------------------------------------------------
    ADDITIONAL RESOURCE CARD
    ------------------------------------------------------- */

#course-module-additional-resource {
  padding: 3rem 2rem;
}

.resource-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.5rem; /* var(--space-6) */
  padding: 1rem !important;
  background-color: #FFF7D6; /* var(--canvas-parchment) / warning-300 */
  border: 1px solid #F7D44F; /* var(--warning-500) */
  border-radius: 1rem; /* var(--radius-2xl) */
  width: 100%;
  max-width: 954px;
  margin: 2rem auto 0; /* margin-top: var(--space-8) */
}

.resource-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  background-color: #F7D44F; /* var(--warning-500) */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2B2C3D; /* var(--text) */
}

.resource-icon svg {
  width: 24px;
  height: 24px;
}

.resource-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.resource-body h4 {
  font-size: 20px;
  font-weight: 700;
  color: #2B2C3D; /* var(--text) */
  margin: 0;
  line-height: 1.3;
}

.resource-body p {
  font-size: 16px;
  font-weight: 400;
  color: #4A5568; /* var(--text-soft) */
  margin: 0;
  line-height: 1.6;
}

/* Resource card button styling - matches backup HTML */
.resource-card .btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  padding: 16px 24px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  border-radius: 8px;
  border: 2px solid #2B2C3D;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(43, 44, 61, 0.10), 0 4px 12px rgba(43, 44, 61, 0.08);
  transition: background-color 0.15s linear, color 0.15s linear, border-color 0.15s linear, box-shadow 0.15s ease, transform 0.15s ease;
}

.resource-card .btn-primary {
  background-color: #2B2C3D;
  color: #fafafa;
}

.resource-card .btn-primary:hover,
.resource-card .btn-primary:focus {
  background-color: #F7D44F; /* var(--brand-500) */
  color: #2B2C3D;
  border-color: #2B2C3D;
}

.resource-card .btn-primary:active {
  background-color: #F0A32F; /* var(--brand-600) */
  color: #2B2C3D;
  border-color: #2B2C3D;
}

.resource-card .btn-icon {
  gap: 0.75rem; /* var(--space-3) */
}

.resource-card .btn-icon svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Responsive: Stack vertically on mobile */
@media (max-width: 600px) {
  #course-module-additional-resource {
    padding: 2rem 1rem;
  }

  .resource-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem; /* var(--space-4) var(--space-6) */
    gap: 1rem;
    margin-top: 1rem;
  }

  .resource-card .btn {
    width: 100%;
  }
}

/* === END: Euka course-module 'single' post template === */
