.referenceSystem {
  padding: 30px 15px;
  text-align: center;

  .referenceGrid {
    display: grid;
    gap: 20px;
    max-width: 70%;
    margin: 0 auto;
    padding: 0 20px;

    @media (min-width: 1280px) {
      grid-template-columns: repeat(5, 1fr);
    }

    @media (max-width: 1279px) and (min-width: 769px) {
      grid-template-columns: repeat(3, 1fr);
    }

    @media (max-width: 768px) and (min-width: 481px) {
      grid-template-columns: repeat(2, 1fr);
      gap: 15px;
      max-width: 85%;
    }

    @media (max-width: 480px) {
      grid-template-columns: 1fr;
      max-width: 90%;
    }

    .referenceItem {
      background: white;
      border: 1px solid #eee;
      border-radius: 12px;
      overflow: hidden;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
      height: 180px;
      display: flex;
      flex-direction: column;
      cursor: pointer;

      &:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      }

      .imageContainer {
        height: 140px;
        padding: 10px;
        background: #f8f9fa;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;

        .referenceLogo {
          width: 80%;
          height: 80%;
          object-fit: contain;
          transition: transform 0.3s ease;
        }
      }

      .referenceContent {
        padding: 12px;
        flex-grow: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;

        .referenceName {
          font-size: 1rem;
          color: #333;
          margin: 0;
          font-weight: 600;
          line-height: 1.2;
          text-align: center;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          -webkit-box-orient: vertical;
          overflow: hidden;
        }
      }
    }
  }

  .modalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;

    .modalContent {
      background: white;
      padding: 40px;
      border-radius: 16px;
      width: 90%;
      max-width: 600px;
      position: relative;

      .closeButton {
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 28px;
        cursor: pointer;
        color: #666;
        transition: color 0.2s ease;

        &:hover {
          color: #333;
        }
      }

      .modalLogo {
        max-width: 300px;
        height: 200px;
        object-fit: contain;
        margin: 0 auto 25px;
      }

      .modalTitle {
        font-size: 1.8rem;
        color: #222;
        margin: 0 0 15px;
      }

      .modalDescription {
        font-size: 1.1rem;
        color: #555;
        line-height: 1.6;
        margin: 0 0 30px;
      }

      .visitButton {
        background: #ff7f00;
        color: white;
        padding: 14px 32px;
        border-radius: 8px;
        font-size: 1.1rem;
        text-decoration: none;
        transition: background 0.2s ease;
        display: inline-block;

        &:hover {
          background: #e66b00;
        }
      }
    }
  }

  .pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;

    button {
      padding: 10px 18px;
      border: none;
      border-radius: 8px;
      background: #f0f0f0;
      color: #666;
      cursor: pointer;
      transition: all 0.2s ease;

      &:hover:not(:disabled) {
        background: #ff7f00;
        color: white;
      }

      &.activePage {
        background: #ff7f00;
        color: white;
      }

      &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
      }
    }
  }

  @media (max-width: 1279px) {
    .referenceGrid .referenceItem {
      height: 200px;

      .imageContainer {
        height: 120px;

        .referenceLogo {
          width: 75%;
          height: 75%;
        }
      }
    }
  }

  @media (max-width: 768px) {
    padding: 30px 15px;

    .referenceGrid {
      .referenceItem {
        height: 180px;

        .imageContainer {
          height: 110px;
          padding: 10px;

          .referenceLogo {
            width: 70%;
            height: 70%;
          }
        }

        .referenceContent {
          padding: 10px;

          .referenceName {
            font-size: 0.9rem;
            -webkit-line-clamp: 1;
          }
        }
      }
    }

    .modalContent {
      padding: 30px;

      .modalLogo {
        max-width: 250px;
        height: 160px;
      }

      .modalTitle {
        font-size: 1.5rem;
      }

      .modalDescription {
        font-size: 1rem;
      }
    }

    .pagination {
      margin-top: 30px;

      button {
        padding: 8px 14px;
        font-size: 0.9rem;
      }
    }
  }

  @media (max-width: 480px) {
    .referenceGrid {
      .referenceItem {
        height: 160px;

        .imageContainer {
          height: 100px;

          .referenceLogo {
            width: 65%;
            height: 65%;
          }
        }

        .referenceContent .referenceName {
          font-size: 0.85rem;
        }
      }
    }

    .modalContent {
      padding: 20px;

      .modalLogo {
        max-width: 200px;
        height: 140px;
      }

      .modalTitle {
        font-size: 1.3rem;
      }

      .visitButton {
        padding: 12px 24px;
        font-size: 1rem;
      }
    }
  }
}
