@import "./common-var.css";

.latest-reports-section {
  background: var(--white);
}

.latest-reports-wrapper {
  position: relative;
}

.latest-reports-title {
  margin: 0 0 30px 0;

  @media (max-width: 991px) {
    margin: 0 0 25px 0;
  }

  @media (max-width: 576px) {
    margin: 0 0 20px 0;
  }
}

.reports-divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    var(--primary-color) 14.9%,
    var(--primary-color) 50%,
    var(--primary-color) 85.58%,
    rgba(255, 255, 255, 0) 100%
  );
  margin: 0 0 47px 0;
  width: 100%;

  @media (max-width: 991px) {
    margin: 0 0 35px 0;
  }

  @media (max-width: 576px) {
    margin: 0 0 25px 0;
  }
}

.reports-scroll-container {
  overflow: visible;

  @media (max-width: 767px) {
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 -15px;
    padding: 0 15px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: smooth;
    /* Break out of container constraints */
    width: calc(100vw - 97px);
    max-width: none;
    
    &::-webkit-scrollbar {
      display: none;
    }
  }
  @media (max-width: 576px) {
    width: calc(100vw - 0px);
    &::-webkit-scrollbar {
      display: none;
    }
  }
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;

  @media (max-width: 1199px) {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }

  @media (max-width: 767px) {
    display: flex;
    gap: 20px;
    grid-template-columns: none;
    /* Ensure total width exceeds container for scroll */
    width: fit-content;
    min-width: 100%;
  }
}

.report-item {
  display: flex;
  flex-direction: column;
  gap: 24px;

  @media (max-width: 767px) {
    /* Better width calculation for scrollable cards */
    min-width: 280px;
    max-width: 420px;
    width: calc((100vw - 60px) / 1.8);
    flex-shrink: 0;
  }

  @media (max-width: 576px) {
    gap: 20px;
    min-width: 260px;
    max-width: 420px;
    width: calc((100vw - 20px) / 1.5);
  }

  @media (max-width: 480px) {
    min-width: 240px;
    max-width: 320px;
    width: calc((100vw - 0px) / 1.25);
  }
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  @media(max-width: 1400px) {
    gap: 17px;
  }
  @media(max-width: 991px) {
    gap: 15px;
  }
}

.report-title {
  color: var(--primary-color);
  font-family: var(--font-type1);
  font-size: 23px;
  font-style: normal;
  font-weight: 500;
  line-height: 34px;
  margin: 0;
  flex: 1;

  @media (max-width: 1400px) {
    font-size: 21px;
    line-height: 28px;
  }

  @media (max-width: 576px) {
    font-size: 18px;
    line-height: 28px;
  }
}

.pdf-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 50px;
  border: 2px solid var(--secondary-color);
  background: transparent;
  text-decoration: none;
  transition: all 0.3s ease;
  min-width: 85px;

  &:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 104, 29, 0.2);

    .pdf-text {
      color: var(--white);
    }

    svg path {
      fill: var(--white);
    }

    .download-line {
      background: var(--white);
    }
  }
}

.pdf-text {
  color: var(--primary-color);
  text-align: center;
  font-family: var(--font-type1);
  font-size: 11.2px;
  font-style: normal;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.download-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;

  svg {
    width: 15px;
    height: 14px;
    flex-shrink: 0;

    path {
      transition: all 0.3s ease;
    }
  }
}

.download-line {
  width: 15px;
  height: 2px;
  background: var(--primary-color);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.report-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  overflow: hidden;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 5px;
    transition: transform 0.3s ease;
  }

  &:hover img {
    transform: scale(1.05);
  }
}

[dir="rtl"] .latest-reports-title {
  text-align: right;
}

[dir="rtl"] .reports-divider {
  background: linear-gradient(
    270deg,
    rgba(255, 255, 255, 0) 0%,
    var(--primary-color) 14.9%,
    var(--primary-color) 50%,
    var(--primary-color) 85.58%,
    rgba(255, 255, 255, 0) 100%
  );
}


[dir="rtl"] .reports-scroll-container {
  @media (max-width: 767px) {
    direction: rtl;
    /* Ensure RTL scroll works properly */
    scroll-behavior: smooth;
  }
}

[dir="rtl"] .reports-grid {
  @media (max-width: 767px) {
    direction: ltr;
    /* Maintain proper flex direction for RTL */
    flex-direction: row;
  }
}
