/* --- Testimonials v3 --- */

.testimonial-grid-v3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
  list-style: none; /* reset for UL */
  padding-left: 0; /* reset for UL */
}

.testimonial-card-v3 {
  background-color: var(--background-white);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  height: 400px;
  overflow-y: auto;
}

.testimonial-card-v3 img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
}

.testimonial-card-v3 blockquote {
  font-style: italic;
  color: var(--light-text);
  margin: 0 0 1rem 0;
  border: none;
  padding: 0;
  flex-grow: 1;
}

.testimonial-card-v3.google-review {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}

.review-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.review-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
}

.review-author {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-weight: 700;
  color: var(--dark-text);
}

.review-time {
  color: var(--light-text);
}

.review-stars {
  color: #fbbc05;
}

.review-text-wrapper {
  position: relative;
  flex-grow: 1;
  overflow-y: auto;
  border-left: 3px solid var(--border-color);
  padding-left: 1rem;
  margin-bottom: 0.5rem;
}

.review-text {
  margin: 0;
  font-style: italic;
  color: var(--light-text);
}

.reviews-button-container {
  text-align: center;
  margin-top: 2rem;
}

/* --- Contact Section --- */
.contact-section {
  padding: 5rem 0;
  background-color: var(--background-light);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.contact-form-wrapper h3,
.contact-info-wrapper h3 {
  margin-bottom: 2rem;
  color: var(--dark-text);
}

.contact-form-wrapper form input,
.contact-form-wrapper form textarea,
.contact-form-wrapper form button {
  box-sizing: border-box;
  width: 100%;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: var(--font-family);
}

.contact-form-wrapper form button {
  background-color: var(--highlight-color);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.3s ease;
}

.contact-form-wrapper form button:hover {
  background-color: #e68a00;
}

.contact-info-wrapper p {
  line-height: 1.7;
  color: var(--light-text);
  margin-bottom: 2rem;
}

.contact-team-photos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.contact-team-photos img {
  width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  object-fit: cover;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.contact-icons {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  list-style: none;
  padding-left: 0;
}

.contact-icons li {
  list-style: none;
}

.contact-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  color: var(--primary-color);
  text-decoration: none;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  font-size: 1.2rem;
}

.contact-icons a:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* --- Blog Carousel --- */
.blog-carousel-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 2rem 0;
  margin: 2rem 0;
}

.blog-carousel {
  display: flex;
  transition: transform 0.5s ease;
  gap: 1.5rem;
}

.blog-article {
  flex: 0 0 calc(25% - 1.125rem); /* 4 columns with gap consideration */
  border-radius: var(--border-radius);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.article-date {
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
}

.article-image {
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.article-image:hover img {
  transform: scale(1.05);
}

.article-title {
  padding: 1rem 1rem 0.5rem;
  margin: 0;
}

.article-title a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 600;
  transition: color 0.3s ease;
}

.article-title a:hover {
  color: var(--primary-color);
}

.article-author {
  padding: 0 1rem;
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.article-excerpt {
  padding: 0 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  flex-grow: 1;
}

.article-link {
  padding: 1rem;
  text-align: right;
}

.article-link a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.article-link a:hover {
  color: var(--highlight-color);
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 10;
  transition: background-color 0.3s ease;
}

.carousel-nav:hover {
  background-color: var(--highlight-color);
}

.carousel-nav.prev {
  left: 10px;
}

.carousel-nav.next {
  right: 10px;
}

/* --- Blog Single --- */
.blog-single {
  padding: 2rem 0 4rem;
}

.blog-single__nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.blog-single__nav .nav-spacer {
  flex: 1;
}

.blog-single__nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.blog-single h1,
.blog-single h2,
.blog-single h3,
.blog-single h4,
.blog-single h5,
.blog-single h6 {
  text-align: left;
}

.blog-single__article .blog-single__hero {
  position: relative;
  width: 100%;
  height: 520px; /* fixed viewport height for hero */
  max-height: 520px;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.blog-single__article .blog-single__hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Slightly bias downwards to avoid showing too much top area */
  object-position: 50% 55%;
}

.blog-single__title {
  margin: 1.5rem 0 0.5rem;
  text-align: left;
}

.blog-single__subtitle {
  margin: 0 0 0.5rem;
  color: var(--light-text);
}

.blog-single__meta {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.blog-single__content img {
  max-width: 50%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  float: right;
}

.blog-single__content::after {
  content: '';
  display: table;
  clear: both;
}

.blog-single__content figure {
  margin: 0.5rem 0 1.5rem;
  max-width: 50%;
  clear: both; /* prevent images from appearing beside previous floated figures */
}

.blog-single__content figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  float: none !important; /* caption should sit directly below */
}

.blog-single__content figure.align-right {
  float: right;
  margin: 0.5rem 0 1.5rem 1.5rem;
  text-align: right;
}
.blog-single__content img.align-right {
  /* for legacy direct images */
  float: right;
}

.blog-single__content figure.align-left {
  float: left;
  margin: 0.5rem 1.5rem 1.5rem 0;
  text-align: left;
}
.blog-single__content img.align-left {
  /* for legacy direct images */
  float: left;
}

.blog-single__content figure.align-center {
  margin: 1rem auto;
  float: none;
  max-width: 60%;
  text-align: center;
}
.blog-single__content img.align-center {
  /* legacy direct images */
  display: block;
  margin: 1rem auto;
  float: none;
  max-width: 60%;
}

/* Prevent consecutive figures from sitting side-by-side */
.blog-single__content figure + figure {
  clear: both;
}
.blog-single__content figure.align-left + figure,
.blog-single__content figure.align-right + figure {
  clear: both;
}
/* Also handle legacy direct images and mixed cases */
.blog-single__content img.align-left + img,
.blog-single__content img.align-right + img,
.blog-single__content figure + img,
.blog-single__content img + figure {
  clear: both;
}

.blog-single__content figcaption {
  font-size: 0.9rem;
  color: var(--light-text);
  margin-top: 0.5rem;
}

/* Chat widet */

.nc-chat {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10000;
  font-family: var(--font-family, Arial, sans-serif);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nc-chat__headline {
  background-color: #e6e8ec87;
  padding: 2px 5px;
  border-radius: var(--border-radius);
  font-size: 0.7rem;
  font-weight: 600;
  color: #4361ee;
  margin-bottom: 0.25rem;
  white-space: nowrap;
}

.nc-chat__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 26px;
  border: none;
  background: #4361ee;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.nc-chat__toggle:focus {
  outline: 2px solid #ff8c00;
  outline-offset: 3px;
}

.nc-chat__panel {
  position: fixed;
  right: 16px;
  bottom: 84px;
  width: min(90vw, 520px);
  height: min(75vh, 600px);
  max-height: 85vh;
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nc-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem 0.25rem 0.75rem;
  border-bottom: 3px solid #ff8c00;
}

.nc-chat__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.nc-chat__close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #333;
  padding: 0.25rem;
}

.nc-chat__frame {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
}

#nc-chat-panel[hidden],
.nc-chat__panel[hidden],
.nc-chat__header[hidden],
.nc-chat__frame[hidden] {
  display: none !important;
}

.nc-chat__frame {
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
}

.nc-chat__panel:not([hidden]) .nc-chat__frame {
  pointer-events: auto !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 1 !important;
}

.nc-chat__panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1100;
}

#nc-chat-panel[hidden] ~ .nc-chat__header,
#nc-chat-panel[hidden] ~ .nc-chat__frame {
  display: none !important;
  pointer-events: none !important;
}

/* --- Responsive --- */

@media (prefers-reduced-motion: no-preference) {
  .nc-chat__panel {
    transition:
      transform 0.18s ease,
      opacity 0.18s ease;
  }

  .nc-chat__panel[hidden] {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (min-width: 768px) {
  /* --- Chat widget width overrides --- */

  .nc-chat__panel {
    width: min(90vw, 520px);
  }
}

@media (max-width: 1180px) {
  /* --- Testimonials v3 --- */

  .testimonial-grid-v3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .blog-article {
    flex: 0 0 calc(33.333% - 1rem); /* 3 columns */
  }
}

@media (max-width: 992px) {
  /* --- Blog --- */

  .blog-article {
    flex: 0 0 calc(50% - 0.75rem); /* 2 columns */
  }

  .blog-single__content img .blog-single__content figure img {
    float: none;
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0; /* reset margins */
  }

  .blog-single__content figure,
  .blog-single__content img,
  .blog-single__content figure img {
    float: none;
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0; /* reset margins */
    text-align: left;
  }
}

@media (max-width: 768px) {
  /* --- Contact Section --- */

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .contact-section {
    padding: 4rem 0;
  }

  .contact-team-photos {
    max-width: 320px;
  }

  .nc-feedback {
    display: none;
  }
}

@media (max-width: 580px) {
  /* --- Testimonials v3 --- */

  .testimonial-grid-v3 {
    grid-template-columns: 1fr;
  }

  .blog-article {
    flex: 0 0 100%; /* 1 column */
  }
}

/* Feedback widget - similar to chat widget but on the left */

.nc-feedback {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 10000;
  font-family: var(--font-family, Arial, sans-serif);
}

.nc-feedback__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 26px;
  border: none;
  background: #ff8c00;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.nc-feedback__toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.nc-feedback__toggle:focus {
  outline: 2px solid #4361ee;
  outline-offset: 3px;
}

.nc-feedback__panel {
  position: fixed;
  left: 16px;
  bottom: 84px;
  width: min(90vw, 420px);
  max-height: 85vh;
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nc-feedback__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 3px solid #ff8c00;
  background: #fafafa;
}

.nc-feedback__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: #333;
}

.nc-feedback__close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #333;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

.nc-feedback__close:hover {
  color: #ff8c00;
}

.nc-feedback__body {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(85vh - 60px);
}

.nc-feedback__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nc-feedback__field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.nc-feedback__field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
}

.nc-feedback__checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400 !important;
  cursor: pointer;
}

.nc-feedback__checkbox-label input[type='checkbox'] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.nc-feedback__field select,
.nc-feedback__field input,
.nc-feedback__field textarea {
  padding: 0.625rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-family: inherit;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.nc-feedback__field select:focus,
.nc-feedback__field input:focus,
.nc-feedback__field textarea:focus {
  outline: none;
  border-color: #ff8c00;
  box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.1);
}

.nc-feedback__field textarea {
  resize: vertical;
  min-height: 100px;
}

.nc-feedback__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.nc-feedback__submit {
  padding: 0.75rem 1.5rem;
  background: #ff8c00;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.1s ease;
}

.nc-feedback__submit:hover {
  background: #e67e00;
}

.nc-feedback__submit:active {
  transform: scale(0.98);
}

.nc-feedback__success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem;
}

.nc-feedback__success svg {
  margin-bottom: 1rem;
}

.nc-feedback__success h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #22c55e;
  margin: 0 0 0.5rem 0;
}

.nc-feedback__success p {
  font-size: 0.9375rem;
  color: #666;
  margin: 0;
}

#nc-feedback-panel[hidden],
.nc-feedback__panel[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
  .nc-feedback__panel {
    transition:
      transform 0.18s ease,
      opacity 0.18s ease;
  }

  .nc-feedback__panel[hidden] {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (max-width: 768px) {
  .nc-feedback__panel {
    width: calc(100vw - 32px);
    left: 16px;
    right: 16px;
  }

  /* Move chat and feedback widgets above sticky navigation footer on calculator pages */
  body.calculator-form-visible .nc-chat,
  body.calculator-form-visible .nc-feedback {
    bottom: 90px;
  }
}
