/* Community and course landing styles for [community_view]. */

body.cob-community-view-has-banner .community-page-hero {
	display: none !important;
}

.community-banner-dynamic.is-empty {
	display: none;
}

.cob-questionnaire-gate {
	direction: rtl;
	text-align: center;
	background: #fff;
	border: 1px solid #eceff3;
	border-radius: 16px;
	padding: 24px;
	margin: 16px auto 24px;
	max-width: 640px;
	color: #1c1c1c;
	line-height: 1.6;
}

.cob-questionnaire-gate p {
	margin: 0;
}

.cob-questionnaire-gate .cob-questionnaire-gate-action {
	margin: 16px 0 0;
}

.cob-course-draft-chip {
	display: table;
	margin: 12px auto 0;
	padding: 6px 14px;
	border-radius: 999px;
	background: #f3f4f6;
	color: #4b5563;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
}

.cob-questionnaire-gate a {
	display: inline-block;
	background: #e91e63;
	color: #fff !important;
	font-weight: 700;
	text-decoration: none;
	border-radius: 10px;
	padding: 12px 20px;
}

/* Community Courses Gallery */
.community-courses-gallery {
    max-width: 1200px;
    margin: 40px auto;
    padding: 30px 20px;
    background: #f9f9f9;
    border-radius: 12px;
}

.courses-gallery-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 30px 0;
}

.courses-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.course-gallery-item {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.course-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.course-gallery-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.course-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.course-gallery-item:hover .course-gallery-image img {
    transform: scale(1.05);
}

.course-gallery-info {
    padding: 15px;
    text-align: center;
}

.course-gallery-name {
    font-size: 18px;
    font-weight: 700;
    color: #E60D64;
    margin: 0;
    line-height: 1.4;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .community-courses-gallery {
        margin: 25px 10px;
        padding: 20px 15px;
    }
    
    .courses-gallery-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .courses-gallery-grid {
        gap: 15px;
    }
    
    .course-gallery-item {
        width: 200px;
    }
    
    .course-gallery-image {
        height: 130px;
    }
    
    .course-gallery-name {
        font-size: 14px;
    }
}

/* Banner sizing: full width, fixed height, crop image to fit */
.community-banner-dynamic-wrapper {
  position: relative;
  width: 100% !important;
  max-width: 100% !important;
}

.community-banner-dynamic {
  width: 100% !important;
  max-width: 100% !important;
  height: 220px !important;
  overflow: hidden !important;
}

.community-banner-img,
.community-banner-dynamic .community-banner-img,
.community-banner-dynamic .course-banner-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}

/* Course page: community and course stay visually separate */
#community-hero.is-course-page {
  text-align: center;
  margin: 16px auto 12px;
  max-width: 820px;
  padding: 0 16px;
}

/* The logo is shifted up over the banner, but its box still occupies
   the original height. Pull the name up into that empty space. */
.community-logo-block {
  margin-bottom: -110px;
}

#community-hero .community-title,
#community-hero.is-course-page .community-title {
  margin-top: 0 !important;
  color: #051143;
}

.community-intro-short {
  max-width: 760px;
  margin: 4px auto 12px;
  padding: 0 16px;
  text-align: center;
  font-size: 18px;
  line-height: 1.6;
  font-weight: 700;
  color: #051143;
}

body.single-community .community-join-container {
  margin: 18px 0 30px !important;
}

.community-join-container .community-join-toggle,
.community-join-container .cob-community-register-btn {
  border-radius: 8px !important;
}

.community-courses-scroll-btn {
  background-color: #147af3;
  color: #fff !important;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.community-courses-scroll-btn:hover {
  background-color: #35c4ee;
  color: #fff !important;
}

.community-join-container .community-course-register-btn {
  background-color: #E60D64 !important;
  color: #fff !important;
  border: none;
  font-size: 16px;
  font-weight: bold;
  padding: 12px 24px;
  cursor: pointer;
}

.community-join-container .community-course-register-btn:hover {
  background-color: #c50a54 !important;
  color: #fff !important;
}

.community-course-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  max-width: 760px;
  margin: 8px auto 4px;
  padding: 0 16px;
}

.community-course-logos img {
  max-width: 160px;
  max-height: 72px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.community-join-container .community-courses-scroll-btn,
.community-join-container .community-join-toggle,
.community-join-container .cob-community-register-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.community-join-container .community-courses-scroll-btn::before,
.community-join-container .community-join-toggle::before,
.community-join-container .cob-community-register-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cpath d='M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM504 312v-64h-64c-13.3 0-24-10.7-24-24s10.7-24 24-24h64v-64c0-13.3 10.7-24 24-24s24 10.7 24 24v64h64c13.3 0 24 10.7 24 24s-10.7 24-24 24h-64v64c0 13.3-10.7 24-24 24s-24-10.7-24-24z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cpath d='M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM504 312v-64h-64c-13.3 0-24-10.7-24-24s10.7-24 24-24h64v-64c0-13.3 10.7-24 24-24s24 10.7 24 24v64h64c13.3 0 24 10.7 24 24s-10.7 24-24 24h-64v64c0 13.3-10.7 24-24 24s-24-10.7-24-24z'/%3E%3C/svg%3E") center / contain no-repeat;
}

#community-courses,
#community-course-details {
  scroll-margin-top: 90px;
}

.community-course-details-heading {
  margin: 28px auto 0;
  max-width: 1200px;
  padding: 0 16px;
  text-align: center;
  color: #051143;
  font-size: 24px;
  font-weight: 700;
}

.community-join-fallback {
  max-width: 900px;
  margin: 36px auto 48px;
  padding: 30px 24px;
  background: #f5f5f5;
  border-radius: 8px;
  text-align: center;
}

.community-join-fallback h2 {
  margin: 0 0 8px;
  color: #051143;
  font-size: 22px;
  font-weight: 700;
}

.community-join-fallback p {
  margin: 0 0 18px;
  color: #333;
  font-size: 16px;
}

.community-courses-join-btn {
  display: inline-block;
  background-color: #147af3;
  color: #fff !important;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  cursor: pointer;
}

.community-courses-join-btn:hover {
  background-color: #35c4ee;
  color: #fff !important;
}


/* Edit Community Link */
.community-edit-link-wrapper {
  margin: 0 auto;
  text-align: center;
}

.community-edit-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #e60d64  0%, #b41b58  100%);
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 115, 170, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.community-edit-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 115, 170, 0.35);
  color: #fff !important;
}

.community-edit-link:active {
  transform: translateY(0);
}

.edit-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Community Members Link Section */
.community-members-link-section {
  text-align: center;
  margin: 25px auto;
  padding: 0 20px;
}

.community-members-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: linear-gradient(135deg, #e60d64 0%, #b20d4f 100%);
  color: #fff !important;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.community-members-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
  color: #fff !important;
}

.community-members-btn:active {
  transform: translateY(0);
}

.members-btn-icon {
  width: 24px;
  height: 24px;
}

/* Community Description */
.community-desc-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.community-desc {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 15px;
}

/* Saved descriptions may still use Quill alignment and size classes. */
.community-desc .ql-align-center {
  text-align: center;
}

.community-desc .ql-align-right {
  text-align: right;
}

.community-desc .ql-align-left {
  text-align: left;
}

.community-desc .ql-align-justify {
  text-align: justify;
}

.community-desc .ql-size-small {
  font-size: 0.75em;
}

.community-desc .ql-size-large {
  font-size: 1.5em;
}

.community-desc .ql-size-huge {
  font-size: 2.5em;
}

.community-desc h1 {
  font-size: 2em;
  font-weight: bold;
  margin: 0.67em 0;
}

.community-desc h2 {
  font-size: 1.5em;
  font-weight: bold;
  margin: 0.75em 0;
}

.community-desc h3 {
  font-size: 1.17em;
  font-weight: bold;
  margin: 0.83em 0;
}

.community-desc p {
  margin: 0.5em 0;
}

.community-desc strong {
  font-weight: bold;
}

.community-desc em {
  font-style: italic;
}

.community-desc u {
  text-decoration: underline;
}

.community-desc s {
  text-decoration: line-through;
}

.community-desc ol,
.community-desc ul {
  padding-right: 1.5em;
  margin: 0.5em 0;
}

.community-desc li {
  margin: 0.25em 0;
}

.community-desc a {
  color: #e60d64;
  text-decoration: underline;
}

.community-desc a:hover {
  color: #e60d64;
}

/* Course Wrapper */
.community-additional-offer-wrapper {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* Responsive */
@media (max-width: 768px) {
  /* Hide empty community logo block to prevent large gap below banner
     (the [community_logo] shortcode renders an empty wrapper when the
     community has no logo set, which still reserves vertical space). */
  .community-logo-block:empty {
    display: none !important;
  }
  .community-logo-block {
    margin: 0 auto !important;
    margin-bottom: -70px !important;
    padding: 0 !important;
  }

  .community-logo-block img.community-logo {
    width: 90px !important;
    height: 90px !important;
  }
  
  /* Tighten spacing between banner and the next block on mobile */
  .community-banner-dynamic-wrapper {
    margin-bottom: 0 !important;
  }
  .community-join-container {
    margin-top: 16px !important;
  }

  .community-course-details-heading {
    font-size: 20px;
  }

  /* Prevent horizontal scroll on entire page */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  /* Override WordPress theme flex layout that causes overflow */
  body .is-layout-flex {
    display: block !important;
  }
  
  /* Fix community description overflow */
  .community-desc {
    width: calc(100% - 30px) !important;
    max-width: calc(100vw - 30px) !important;
    padding: 0 15px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    white-space: normal !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    text-align: center !important;
  }
  
  .community-edit-link-wrapper {
    padding: 8px 12px;
  }

  .community-edit-link {
    font-size: 13px;
    padding: 8px 16px;
    gap: 6px;
  }

  .edit-icon {
    width: 14px;
    height: 14px;
  }

  .community-members-btn {
    font-size: 16px;
    padding: 14px 24px;
    gap: 10px;
  }
  
  .members-btn-icon {
    width: 20px;
    height: 20px;
  }
  
  .community-additional-offer-wrapper {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
}

.community-page-layout {
    width: 100%;
}

.community-page-layout > div {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

.community-page-layout .community-page-hero,
.community-page-layout .community-banner-dynamic-wrapper,
.community-page-layout .community-banner-dynamic,
.community-page-layout .community-banner-img,
.community-page-layout .community-page-hero img,
.community-page-layout .community-page-hero .wp-block-image {
    width: 100% !important;
    max-width: 100% !important;
}

.community-page-layout .community-banner-img,
.community-page-layout .community-page-hero img {
    display: block;
    object-fit: cover;
}

/* Keep community text in its own flow. The global stylesheet shifts the link column over the details. */
body.single-community .community-desc {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 16px;
    overflow-wrap: anywhere;
}

body.single-community .community-info-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 16px 8px !important;
    overflow: visible;
    direction: rtl;
}

body.single-community .community-info-wrapper #community-info,
body.single-community .community-info-wrapper .community-links {
    width: 100%;
    max-width: 720px;
    flex: none;
    position: static !important;
    left: auto !important;
    right: auto !important;
    margin: 0 auto;
    text-align: center;
}

body.single-community #community-info .community-name,
body.single-community #community-info .community-short,
body.single-community .community-contact,
body.single-community .community-contact a {
    overflow-wrap: anywhere;
}

body.single-community .community-contact a {
    color: #051143;
}

body.single-community .community-contact:not(:has(a:not(:empty))) {
    display: none;
    margin: 0;
}

body.single-community .community-contact a:empty {
    display: none;
}

body.single-community .community-contact a:not(:empty) {
    display: block;
}

body.single-community .community-links {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center !important;
    align-items: center;
    gap: 12px;
    width: 100% !important;
    direction: rtl;
    max-width: 720px;
    line-height: 0;
    text-align: center !important;
}

body.single-community .community-links .link-row {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #7e86aa;
    box-shadow: 0 1px 4px rgba(5, 17, 67, 0.08);
}

body.single-community .community-links .link-row:hover {
    border-color: #E60D64;
}

body.single-community .community-links .link-row img {
    width: 22px;
    height: 22px;
    margin: 0;
    object-fit: contain;
}

body.single-community .community-links .link-row a {
    position: absolute;
    inset: 0;
    max-width: none;
    overflow: hidden;
    font-size: 0;
    line-height: 0;
    color: transparent;
    white-space: nowrap;
    text-decoration: none;
}

body.single-community .community-benefits {
    max-width: 900px;
    margin: 28px auto 0;
    padding: 0 16px;
}

body.single-community .community-benefits-title {
    text-align: center;
    color: #051143;
}

body.single-community .community-benefits-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    justify-content: center;
    gap: 12px;
}

body.single-community .benefit-box {
    width: auto !important;
    height: auto !important;
    min-height: 72px;
    max-width: 200px;
    flex: 1 1 150px !important;
    padding: 14px 16px;
    border: 1px solid #e4e7f2;
    border-radius: 12px;
    color: #051143;
    font-size: 15px !important;
    line-height: 1.35;
    overflow-wrap: anywhere;
    box-shadow: 0 2px 8px rgba(5, 17, 67, 0.06);
}

body.single-community .community-courses-gallery,
body.single-community .community-cta,
body.single-community .community-join-fallback,
body.single-community .community-contact-card.fade-in {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    float: none;
}

body.single-community .community-contact-card.fade-in {
    display: block;
}
